dtb.Build()
dim filter as string
For Each cus() As String In dt.GetValues("排序|位置|回路名称|类别")
Dim dtbr As DataRow = DataTables("气量统计").AddNew()
dtbr("排序") = cus(0)
dtbr("位置") = cus(1)
dtbr("回路名称") = cus(2)
dtbr("类别") = cus(3)
'dtbr("合并字符") = cus(0) & cus(1) & cus(2) & cus(3)
filter = "排序 = '" & cus(0) & "'and 位置 = '" & cus(1) & "' and 回路名称 = '" & cus(2) & "' and 类别 " & IIF(cus(3) > ""," = '" & cus(3) & ""'," is null")
For Each prd As Date In prds
filter = filter & " and [日期] = '" & prd.Date & "'"
dtbr(prd) = dt.Compute("Sum(实际用气量)",filter )
Next
Next
MainTable = Tables("气量统计")