Foxtable(狐表)用户栏目专家坐堂 → 请问老师代码


  共有2357人关注过本帖树形打印复制链接

主题:请问老师代码

帅哥哟,离线,有人找我吗?
guimingze
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:895 威望:0 精华:0 注册:2017/2/15 20:56:00
请问老师代码  发帖心情 Post By:2017/3/11 16:19:00 [只看该作者]


s1 = iif(s1 > "", s1, "空")

s2 = iif(s2 > "", s2, "空")



放在以下代码里的哪呢?



Select Case e.Book.TempLate
    
    Case "横名册"
        
        Dim Filter As String = "单位名称 = '" & e.DataRow("单位名称") & "'"
        Dim dt As DataTable = DataTables("竖名册")
        Dim sum1 As Double = dt.Compute("Sum(正科配备)",Filter)
        Dim sum2 As Double = dt.Compute("Sum(实际正科)",Filter)
        Dim sum3 As Double = dt.Compute("Sum(副科配备)",Filter)
        Dim sum4 As Double = dt.Compute("Sum(实际副科)",Filter)
        Dim s1 As String = dt.GetComboListString("正科职数空缺", filter).replace("|", ",").trim(",")
        Dim s2 As String = dt.GetComboListString("正科职数备注", filter).replace("|", ",").trim(",")
        Dim s3 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
        Dim s4 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
        e.Book.Marks("分组统计字符") = "单位:" & e.DataRow("单位名称") & " 正科配备:" & sum1 & " 实际正科:" & sum2 & " 正科空缺:" & s1 & " 正科备注:" & s2 & "        副科配备:" & sum3 & " 实际副科:" & sum4 & " 副科空缺:" & s3 & " 副科备注:" & s4         
End Select



 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110744 积分:563646 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2017/3/11 16:29:00 [只看该作者]

看好你自己的贴,不要重复提问题

 

http://foxtable.com/bbs/dispbbs.asp?boardid=2&Id=97080&page=2&star=2


 回到顶部
帅哥哟,离线,有人找我吗?
guimingze
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:895 威望:0 精华:0 注册:2017/2/15 20:56:00
回复:(有点蓝)看好你自己的贴,不要重复提问题&n...  发帖心情 Post By:2017/3/11 21:22:00 [只看该作者]

老师  我又出现一个新的问题   若正科空缺为0   正科备注也没有   那么希望 不显示正科空缺   正科备注的字样可以实现么?

若   正科配备:1 实际正科:1     正科空缺: 正科备注:

      副科配备:1 实际副科:1     副科空缺: 副科备注:

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/3/12 20:47:00 [只看该作者]

 把不想显示的内容,写在 里面

 

Select Case e.Book.TempLate
    
    Case "横名册"
        
        Dim Filter As String = "单位名称 = '" & e.DataRow("单位名称") & "'"
        Dim dt As DataTable = DataTables("竖名册")
        Dim sum1 As Double = dt.Compute("Sum(正科配备)",Filter)
        Dim sum2 As Double = dt.Compute("Sum(实际正科)",Filter)
        Dim sum3 As Double = dt.Compute("Sum(副科配备)",Filter)
        Dim sum4 As Double = dt.Compute("Sum(实际副科)",Filter)
        Dim s1 As String = dt.GetComboListString("正科职数空缺", filter).replace("|", ",").trim(",")
        Dim s2 As String = dt.GetComboListString("正科职数备注", filter).replace("|", ",").trim(",")
        Dim s3 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
        Dim s4 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
s1 = iif(s1 > "",  "正科空缺:" & s1, "")

s2 = iif(s2 > "",  "副科空缺:" & s2, "")

        e.Book.Marks("分组统计字符") = "单位:" & e.DataRow("单位名称") & " 正科配备:" & sum1 & " 实际正科:" & sum2 & " " & s1 & " " & s2 & "        副科配备:" & sum3 & " 实际副科:" & sum4 & " 副科空缺:" & s3 & " 副科备注:" & s4         
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
guimingze
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:895 威望:0 精华:0 注册:2017/2/15 20:56:00
回复:(有点色) 把不想显示的内容,写在 里面...  发帖心情 Post By:2017/3/12 22:25:00 [只看该作者]

不是为空这个字符  ,而是  如果没有内容那么,就不用显示     比如“   副科备注:” 后面有内容就显示为副科备注:wenasdffdsd     若没有内容则不用显示副科备注 

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/3/12 23:02:00 [只看该作者]

认认真真看4楼代码,参考着改。

 回到顶部
帅哥哟,离线,有人找我吗?
guimingze
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:895 威望:0 精华:0 注册:2017/2/15 20:56:00
回复:(有点色)认认真真看4楼代码,参考着改。  发帖心情 Post By:2017/4/14 11:03:00 [只看该作者]

认真看过后加红色的修改是否能达到 机关后续没有字段就不显示机关、参公事业后面没有字段就不显示参公事业  事业后面没有字段就不显示事业,之前老师给过分开的例子但是我这S7都是和在一起的啊?  如何修改呢?

Select Case e.Book.TempLate
Case "横名册"
    
    Dim Filter As String = "单位名称 = '" & e.DataRow("单位名称") & "'"
    Dim dt As DataTable = DataTables("竖名册")
    Dim sum1 As Double = dt.Compute("Sum(正科配备)",Filter)
    Dim sum2 As Double = dt.Compute("Sum(实际正科)",Filter)
    Dim sum3 As Double = dt.Compute("Sum(副科配备)",Filter)
    Dim sum4 As Double = dt.Compute("Sum(实际副科)",Filter)
    Dim s1 As String = dt.GetComboListString("正科职数空缺", filter).replace("|", ",").trim(",")
    Dim s2 As String = dt.GetComboListString("正科职数备注", filter).replace("|", ",").trim(",")
    Dim s3 As String = dt.GetComboListString("副科职数空缺", filter).replace("|", ",").trim(",")
    Dim s4 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
    Dim s5 As String = dt.GetComboListString("下属部门", filter).replace("|", ",").trim(",")
    Dim s7 As String = ""
    s7 &= "机关:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '机关'").replace("|", ",").trim(",") & "    "
    s7 &= "参公事业:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '参公事业'").replace("|", ",").trim(",") & "    "
    s7 &= "事业:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'").replace("|", ",").trim(",")
    Dim jg As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'")
    s1 = iif(s1 > "",  "正科职数空缺:" & s1, "")
    s2 = iif(s2 > "",  "正科职数备注:" & s2, "")
    s3 = iif(s3 > "",  "副科职数空缺:" & s3, "")
    s4 = iif(s4 > "",  "副科职数备注:" & s4, "")
    s7 = iif(s7 > "",  "机关:" & s7, "")
    e.Book.Marks("分组统计字符") = "单位:" & e.DataRow("单位名称") & "(" & s7.Trim() & ")" & Chr(13) & Chr(10) & " 正科配备:" & sum1 & " 实际正科:" & sum2 & " " & s1 & " " & s2 & Chr(13) & Chr(10) & " 副科配备:" & sum3 & " 实际副科:" & sum4 & " " & s3 & " " & s4
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/4/14 11:08:00 [只看该作者]

    Dim s8 as string = dt.GetComboListString("下属部门", filter & " and 单位性质 = '机关'").replace("|", ",").trim(",")
    Dim s9 as string = dt.GetComboListString("下属部门", filter & " and 单位性质 = '参公事业'").replace("|", ",").trim(",")
    Dim s10 as string= dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'").replace("|", ",").trim(",")
    s7 &= iif(s8 > "", "机关:" & s8, "")
    s7 &= iif(s9 > "", "参公事业::" & s9, "")
    s7 &= iif(s10 > "", "事业:" & s10, "")

 回到顶部
帅哥哟,离线,有人找我吗?
guimingze
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:895 威望:0 精华:0 注册:2017/2/15 20:56:00
回复:(有点色)    Dim s8 as strin...  发帖心情 Post By:2017/4/14 14:19:00 [只看该作者]

如何修改呢?  老师还是实现不了啊

Select Case e.Book.TempLate
Case "横名册"
    
    Dim Filter As String = "单位名称 = '" & e.DataRow("单位名称") & "'"
    Dim dt As DataTable = DataTables("竖名册")
    Dim sum1 As Double = dt.Compute("Sum(正科配备)",Filter)
    Dim sum2 As Double = dt.Compute("Sum(实际正科)",Filter)
    Dim sum3 As Double = dt.Compute("Sum(副科配备)",Filter)
    Dim sum4 As Double = dt.Compute("Sum(实际副科)",Filter)
    Dim s1 As String = dt.GetComboListString("正科职数空缺", filter).replace("|", ",").trim(",")
    Dim s2 As String = dt.GetComboListString("正科职数备注", filter).replace("|", ",").trim(",")
    Dim s3 As String = dt.GetComboListString("副科职数空缺", filter).replace("|", ",").trim(",")
    Dim s4 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
    Dim s5 As String = dt.GetComboListString("下属部门", filter).replace("|", ",").trim(",")
    Dim s7 As String = ""
    s7 &= "机关:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '机关'").replace("|", ",").trim(",") & "    "
    s7 &= "参公事业:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '参公事业'").replace("|", ",").trim(",") & "    "
    s7 &= "事业:" & dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'").replace("|", ",").trim(",")
    Dim jg As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'")
    s1 = iif(s1 > "",  "正科职数空缺:" & s1, "")
    s2 = iif(s2 > "",  "正科职数备注:" & s2, "")
    s3 = iif(s3 > "",  "副科职数空缺:" & s3, "")
    s4 = iif(s4 > "",  "副科职数备注:" & s4, "")
    s7 = iif(s7 > "",  "机关:" & s7, "")
    Dim s8 As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '机关'").replace("|", ",").trim(",")
    Dim s9 As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '参公事业'").replace("|", ",").trim(",")
    Dim s10 As String= dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'").replace("|", ",").trim(",")
    s7 &= iif(s8 > "", "机关:" & s8, "")
    s7 &= iif(s9 > "", "参公事业::" & s9, "")
    s7 &= iif(s10 > "", "事业:" & s10, "")
    e.Book.Marks("分组统计字符") = "单位:" & e.DataRow("单位名称") & "(" & s7.Trim() & ")" & Chr(13) & Chr(10) & " 正科配备:" & sum1 & " 实际正科:" & sum2 & " " & s1 & " " & s2 & Chr(13) & Chr(10) & " 副科配备:" & sum3 & " 实际副科:" & sum4 & " " & s3 & " " & s4
End Select
图片点击可在新窗口打开查看此主题相关图片如下:{_1e%aa2u32j4lwa0q~1ff0.png
图片点击可在新窗口打开查看

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/4/14 14:33:00 [只看该作者]

Select Case e.Book.TempLate
Case "横名册"
   
    Dim Filter As String = "单位名称 = '" & e.DataRow("单位名称") & "'"
    Dim dt As DataTable = DataTables("竖名册")
    Dim sum1 As Double = dt.Compute("Sum(正科配备)",Filter)
    Dim sum2 As Double = dt.Compute("Sum(实际正科)",Filter)
    Dim sum3 As Double = dt.Compute("Sum(副科配备)",Filter)
    Dim sum4 As Double = dt.Compute("Sum(实际副科)",Filter)
    Dim s1 As String = dt.GetComboListString("正科职数空缺", filter).replace("|", ",").trim(",")
    Dim s2 As String = dt.GetComboListString("正科职数备注", filter).replace("|", ",").trim(",")
    Dim s3 As String = dt.GetComboListString("副科职数空缺", filter).replace("|", ",").trim(",")
    Dim s4 As String = dt.GetComboListString("副科职数备注", filter).replace("|", ",").trim(",")
    Dim s5 As String = dt.GetComboListString("下属部门", filter).replace("|", ",").trim(",")
    Dim jg As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'")
    s1 = iif(s1 > "",  "正科职数空缺:" & s1, "")
    s2 = iif(s2 > "",  "正科职数备注:" & s2, "")
    s3 = iif(s3 > "",  "副科职数空缺:" & s3, "")
    s4 = iif(s4 > "",  "副科职数备注:" & s4, "")
    Dim s8 As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '机关'").replace("|", ",").trim(",")
    Dim s9 As String = dt.GetComboListString("下属部门", filter & " and 单位性质 = '参公事业'").replace("|", ",").trim(",")
    Dim s10 As String= dt.GetComboListString("下属部门", filter & " and 单位性质 = '事业'").replace("|", ",").trim(",")
    Dim s7 As String = ""
    s7 &= iif(s8 > "", "机关:" & s8, "")
    s7 &= iif(s9 > "", "参公事业::" & s9, "")
    s7 &= iif(s10 > "", "事业:" & s10, "")
    e.Book.Marks("分组统计字符") = "单位:" & e.DataRow("单位名称") & "(" & s7.Trim() & ")" & Chr(13) & Chr(10) & " 正科配备:" & sum1 & " 实际正科:" & sum2 & " " & s1 & " " & s2 & Chr(13) & Chr(10) & " 副科配备:" & sum3 & " 实际副科:" & sum4 & " " & s3 & " " & s4
End Select

 回到顶部