Dim b As New SQLGroupTableBuilder("统计表1","fh") b.Groups.AddDef("批次") b.Groups.AddDef("日期",DateGroupEnum.month, "月") b.Totals.AddDef("实孵数量") b.Totals.AddDef("公雏") b.Totals.AddDef("母雏") b.Totals.AddDef("次苗") b.Totals.AddDef("死残苗") b.Totals.AddExp("出苗总数","iif([公雏] is null,0,[公雏])+iif([母雏] is null,0,[母雏])+iif([次苗] is null,0,[次苗])+iif([死残苗] is null,0,[死残苗])") b.Totals.AddExp("健雏率", "iif([公雏] is null And [母雏] is null And [次苗] is null And [死残苗] is null,0,(iif([公雏] is null,0,[公雏])+iif([母雏] is null,0,[母雏]))/(iif([公雏] is null,0,[公雏])+iif([母雏] is null,0,[母雏])+iif([次苗] is null,0,[次苗])+iif([死残苗] is null,0,[死残苗])))",AggregateEnum.Average) b.Decimals=3 b.Build Tables("窗口1_Table1").DataSource = DataTables("统计表1")
|