Dim g As New CrossTableBuilder("统计表1", DataTables("d"), "[更新时间] >= '12-31-2022'")
g.HGroups.AddDef("更新时间", DateGroupEnum.Hour, "时")
g.VGroups.AddDef("更新时间", DateGroupEnum.Year)
g.VGroups.AddDef("更新时间")
g.VGroups.AddDef("更新时间", DateGroupEnum.Day)
g.Totals.AddDef("净重", "净重")
g.Filter = "[更新时间] >= '12-31-2022'"
g.FromServer = True
g.Build()
MainTable = Tables("统计表1")
Dim sr, s As String
Dim dt As Date
For Each dc As DataCol In DataTables("统计表1").DataCols '遍历所有列
If dc.Caption <> "时" Then
sr = dc.Caption
s = sr.Replace("_", "/") '将123替换为789
If IsDate(s) Then
dt = CDate(s)
If dt = Date.Today.AddDays( - 3) Then
DataTables("统计表1").DataCols.Add("3日前", GetType(Double), dc.name) '增加名为“吨”的列
Output.Show("正确,3日前 " & dc.Name & " ---- " & dc.Caption & " ... " & dt)
End If
End If
End If
Next