Dim cn As String = "" '数据源名(空白时为内数据表)
Dim bm As String = "统计表1"
Dim b As New SQLCrossTableBuilder(bm,"表A")
Dim d As fxDataSource
b.ConnectionName = cn
b.HGroups.AddDef("公司")
b.HGroups.AddDef("客户")
b.VGroups.AddExp("出门条", "iif(出门条=true,'出门条_有','出门条_无')")
b.Totals.AddDef("金额")
b.VerticalTotal = True
d = b.BuildDataSource()
b = New SQLCrossTableBuilder(bm,"表A")
Dim d1 As fxDataSource
b.ConnectionName = cn
b.HGroups.AddDef("公司")
b.HGroups.AddDef("客户")
b.VGroups.AddExp("送货单", "iif(送货单=true,'送货单_有','送货单_无')")
b.Totals.AddDef("金额")
b.VerticalTotal = True
d1 = b.BuildDataSource()
b = New SQLCrossTableBuilder(bm,"表A")
Dim d2 As fxDataSource
b.ConnectionName = cn
b.HGroups.AddDef("公司")
b.HGroups.AddDef("客户")
b.VGroups.AddExp("客户签字", "iif(客户签字=true,'客户签字_有','客户签字_无')")
b.Totals.AddDef("金额")
b.VerticalTotal = True
d2 = b.BuildDataSource()
Dim Cols As String = "公司|客户"
d.Combine(Cols.split("|"),d1,Cols.split("|"))
d.Combine(Cols.split("|"),d2,Cols.split("|"))
d.Show(bm)
Tables(bm).AutoSizeCols
MainTable = Tables(bm)