目录树一共有三个节点
怎么实现第二个节点中的年数据等于第一个节点的值
怎么实现第三个节点中的年数据等于第一个节点的值 月数据等于第二个节点的值
此主题相关图片如下:捕获.png

Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("卷宗入库"))
b.Groups.AddDef("录入时间",DateGroupEnum.Year,"年")
b.Groups.AddDef("录入时间",DateGroupEnum.Month,"月")
b.Groups.AddDef("承办人")
b.Totals.AddDef("承办人",AggregateEnum.Count,"卷宗编号") '根据客户列来统计记录数,也就是卷宗编号
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "年|月|承办人")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim Product As String = nd.DataRow("承办人")
Select Case nd.Level
Case 0
nd.Text = nd.text & "年(" & dt.Compute("Sum(卷宗编号)","年 = " & Year) & "卷" & DataTables("卷宗入库").sqlCompute("Sum(卷宗册数)","Year(录入时间)='" & nd.text & "'") & "册)"
Case 1
nd.Text = nd.text & "月(" & dt.Compute("Sum(卷宗编号)","年 = " & Year & " And 月 = " & Month) & "卷" & DataTables("卷宗入库").sqlCompute("Sum(卷宗册数)","Year(录入时间)='" & nd.text & "'" And "Month(录入时间)='" & nd.text & "'") & "册)"
Case 2
nd.Text = nd.text & "(" & nd.DataRow("卷宗编号") & "卷" & DataTables("卷宗入库").sqlCompute("Sum(卷宗册数)","Year(录入时间)='" & nd.text & "'" And "month(录入时间)='" & nd.text & "'" And "承办人='" & nd.text & "'") & "册)"
End Select
Next
trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(卷宗编号)") & "卷" & DataTables("卷宗入库").Compute("Sum(卷宗册数)") & "册)",0)
trv.ResumeRedraw