以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  这个垂直分组列有啥问题了为啥加了2个 ,但是没有分层  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=129040)

--  作者:susu312
--  发布时间:2018/12/20 13:15:00
--  这个垂直分组列有啥问题了为啥加了2个 ,但是没有分层

If Tables("时间节点_Table1").Cols.Contains("合计")  Then
    e.Form.Controls("jiZhiTime").Error="请选择截止时间"
    Return
End If
 
\'\'获取统计控件的值
Dim chuiZhi As String = e.Form.Controls("chuiZhi").Value
Dim chuiZhi1 As String = e.Form.Controls("chuiZhi1").Value
If chuiZhi Is Nothing  Then
    e.Form.Controls("chuiZhi").Error="请选择垂直分组列"
    Return
Else If chuiZhi = chuiZhi1 Then
    e.Form.Controls("chuiZhi1").Error="垂直分组列1和2不允许重复"
    Return
Else
   chuiZhi = chuiZhi.Replace(" ","")
   chuiZhi1 = chuiZhi.Replace(" ","")
End If

Dim b As New CrossTableBuilder("统计表1", DataTables("时间节点_Table1"))
b.HGroups.AddDef("离退休单位") \'添加单位列用于水平分组
If chuiZhi1 Is Nothing Then
   b.VGroups.AddDef(chuiZhi,chuiZhi & "_{0}" ) \'添加垂直分组
Else
   b.VGroups.AddDef(chuiZhi) \'添加垂直分组
   b.VGroups.AddDef(chuiZhi1) \'添加垂直分组
End If
b.Totals.AddDef(chuiZhi, AggregateEnum.Count) \'添加用于统计
b.HorizontalTotal = True   \'水平方向生成汇总
b.VerticalTotal = True  \'垂直方向生成汇总
b.Build
Tables("时间节点_Table1").DataSource = DataTables("统计表1")
 \'\'设置表格居中
For Each c As Col In Tables("时间节点_Table1").Cols
      c.TextAlign  = TextAlignEnum.Center
Next
\'\'使得按钮点完后,不要再是选定色
e.form.controls("Table1").Select

 

为啥红色那里我选了两个分组列,但是,表里出来只有1层,没有俩层?


--  作者:有点蓝
--  发布时间:2018/12/20 13:27:00
--  
这样试试

\'\'获取统计控件的值
Dim chuiZhi As String = e.Form.Controls("chuiZhi").text
Dim chuiZhi1 As String = e.Form.Controls("chuiZhi1").text
If chuiZhi Is Nothing  Then
    e.Form.Controls("chuiZhi").Error="请选择垂直分组列"
    Return
Else If chuiZhi = chuiZhi1 Then
    e.Form.Controls("chuiZhi1").Error="垂直分组列1和2不允许重复"
    Return
Else
   chuiZhi = chuiZhi.Replace(" ","")
   chuiZhi1 = chuiZhi.Replace(" ","")
End If

Dim b As New CrossTableBuilder("统计表1", DataTables("时间节点_Table1"))
b.HGroups.AddDef("离退休单位") \'添加单位列用于水平分组
If chuiZhi1 = "" Then
   b.VGroups.AddDef(chuiZhi,chuiZhi & "_{0}" ) \'添加垂直分组
Else
   b.VGroups.AddDef(chuiZhi) \'添加垂直分组
   b.VGroups.AddDef(chuiZhi1) \'添加垂直分组
End If

……


--  作者:susu312
--  发布时间:2018/12/20 13:39:00
--  
以下是引用有点蓝在2018/12/20 13:27:00的发言:
这样试试

\'\'获取统计控件的值
Dim chuiZhi As String = e.Form.Controls("chuiZhi").text
Dim chuiZhi1 As String = e.Form.Controls("chuiZhi1").text
If chuiZhi Is Nothing  Then
    e.Form.Controls("chuiZhi").Error="请选择垂直分组列"
    Return
Else If chuiZhi = chuiZhi1 Then
    e.Form.Controls("chuiZhi1").Error="垂直分组列1和2不允许重复"
    Return
Else
   chuiZhi = chuiZhi.Replace(" ","")
   chuiZhi1 = chuiZhi.Replace(" ","")
End If

Dim b As New CrossTableBuilder("统计表1", DataTables("时间节点_Table1"))
b.HGroups.AddDef("离退休单位") \'添加单位列用于水平分组
If chuiZhi1 = "" Then
   b.VGroups.AddDef(chuiZhi,chuiZhi & "_{0}" ) \'添加垂直分组
Else
   b.VGroups.AddDef(chuiZhi) \'添加垂直分组
   b.VGroups.AddDef(chuiZhi1) \'添加垂直分组
End If

……

搞定了, 谢谢老师