Foxtable(狐表)用户栏目专家坐堂 → 最大值问题


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

主题:最大值问题

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/18 10:12:00 [显示全部帖子]

Dim dtr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "A","B","C","D"
       
        Dim Names() As  String = {"A","B","C","D"}
        Dim maxname As String
        Dim maxvalue As Double = 0
        For Each Name As String In Names
            If e.DataRow(name) > maxValue Then
                maxName = name
                maxValue = e.DataRow(name)
            End If
        Next
        If maxname > "" Then
            e.DataRow("最大值") = maxvalue
            e.DataRow("合计最大值项目名称") = maxName
        Else
            e.DataRow("最大值") = Nothing
            e.DataRow("合计最大值项目名称") = Nothing
        End If
       
        dtr("合计") = dtr("A") + dtr("B") + dtr("C") + dtr("D")
End Select

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/8/18 11:17:00 [显示全部帖子]

Dim dtr As DataRow = e.DataRow
Select Case e.DataCol.Name
    Case "A","B","C","D"
       
        Dim Names() As  String = {"A","B","C","D"}
        Dim maxname As String
        Dim maxvalue As Double = 0
        For Each Name As String In Names
            If e.DataRow(name) > maxValue Then
                maxName = name
                maxValue = e.DataRow(name)
            End If
        Next
        If maxname > "" Then
            e.DataRow("最大值") = maxName
        Else
            e.DataRow("最大值") = Nothing
        End If
       
        dtr("合计") = dtr("A") + dtr("B") + dtr("C") + dtr("D")
    Case "合计"
        Dim fdr As DataRow = e.DataTable.Find("", "合计 desc")
        e.DataTable.ReplaceFor("合计最大值项目名称", fdr("项目名称"))
End Select

 回到顶部