以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]自定义样式 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=99268) |
-- 作者:苏州老街 -- 发布时间:2017/4/15 21:51:00 -- [求助]自定义样式 老师,如果金额列是负数逻辑列就显示借,如果金额列是整数逻辑列就显示贷。谢谢。 |
-- 作者:有点蓝 -- 发布时间:2017/4/16 9:27:00 -- 首先、设置逻辑列的格式 其次,逻辑列如果是表达式 IIF([金额] > 0,true,false) 如果是代码. DataColChanged事件 If e.DataCol.Name = "金额" Then e.DataRow("逻辑列") = IIF(e.NewValue > 0,True,False) End If |
-- 作者:苏州老街 -- 发布时间:2017/4/16 11:25:00 -- 谢谢老师,星期天也来麻烦你,太感谢了!。 我有一个表的代码有修改好多处,以前下载的农行数据支出列和收入列是分开的,现在合并成一列(交易金额)收入是整数支出是负数。现在想要老师帮我修改代码。
|
-- 作者:有点蓝 -- 发布时间:2017/4/16 11:43:00 -- 代码呢?在哪?我拿什么来改? |
-- 作者:苏州老街 -- 发布时间:2017/4/16 12:27:00 -- 老师,下面的收入金额和支出金额列合并成交易金额列了,交易金额列数据用正负数来显示的。 \'Select Case e.DataCol.Name \' Case "方向","收入金额","支出金额" \' Dim drs As List(of DataRow) \' Dim Filter As String \'Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [方向] = \'" & e.DataRow("方向") & "\'" \'drs = e.DataTable.Select(Filter) \' For i As Integer = 0 To drs.Count - 1 \' Dim dr = drs(i) \' If i = drs.Count - 1 Then \' Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = \'" & dr("方向") & "\'" \' Dim Val1 As Double = e.DataTable.Compute("Sum(收入金额)",Filter) \' Dim Val2 As Double = e.DataTable.Compute("Sum(支出金额)",Filter) \' dr("累计收入") = Val1 \' dr("累计支出") = Val2 \' Else \' dr("累计收入") = Nothing \' dr("累计支出") = Nothing \' End If \'Next \'If e.DataCol.Name = "方向" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then \' Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [方向] = \'" & e.OldValue & "\'" \' drs = e.DataTable.Select(Filter) \' For i As Integer = 0 To drs.Count - 1 \' Dim dr = drs(i) \' If i = drs.Count - 1 Then \' Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = \'" & dr("方向") & "\'" \' Dim Val1 As Double = e.DataTable.Compute("Sum(收入金额)",Filter) \' Dim Val2 As Double = e.DataTable.Compute("Sum(支出金额)",Filter) \' dr("累计收入") = Val1 \' dr("累计支出") = Val2 \' Else \' dr("累计收入") = Nothing \' dr("累计支出") = Nothing \' End If \' Next \' End If \' Dim dr2 As DataRow = e.DataTable.Find("方向 is not null","[_Identify] desc") \' Dim V1 = e.DataTable.Compute("Sum(累计收入)","累计收入 > 0") \' Dim V2 = e.DataTable.Compute("Sum(累计支出)","累计支出 > 0") \' e.DataTable.ReplaceFor("余额", Nothing) \' dr2("余额") = V1 - V2 \'End Select [此贴子已经被作者于2017/4/16 12:31:06编辑过]
|
-- 作者:有点蓝 -- 发布时间:2017/4/16 13:34:00 -- 设置逻辑列的格式:http://www.foxtable.com/webhelp/scr/1306.htm Select Case e.DataCol.Name Case "方向","交易金额" Dim drs As List(of DataRow) Dim Filter As String Filter = "[_Identify] >= " & e.DataRow("_Identify") & " And [方向] = \'" & e.DataRow("方向") & "\'" drs = e.DataTable.Select(Filter) For i As Integer = 0 To drs.Count - 1 Dim dr = drs(i) If i = drs.Count - 1 Then Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = \'" & dr("方向") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(交易金额)",Filter) dr("余额") = Val1 Else dr("余额") = Nothing End If Next If e.DataCol.Name = "方向" AndAlso e.OldValue IsNot Nothing AndAlso e.OldValue <> e.NewValue Then Filter = "[_Identify] > " & e.DataRow("_Identify") & " And [方向] = \'" & e.OldValue & "\'" drs = e.DataTable.Select(Filter) For i As Integer = 0 To drs.Count - 1 Dim dr = drs(i) If i = drs.Count - 1 Then Filter = "[_Identify] <= " & dr("_Identify") & " And [方向] = \'" & dr("方向") & "\'" Dim Val1 As Double = e.DataTable.Compute("Sum(交易金额)",Filter) dr("余额") = Val1 Else dr("余额") = Nothing End If Next End If End Select |