以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 遍历出数值后,怎么保存下来,进行二次运算? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=107718) |
-- 作者:yancheng -- 发布时间:2017/10/8 15:41:00 -- 遍历出数值后,怎么保存下来,进行二次运算? Dim tb As Table =Tables("资产负债表") Dim tb2 As Table = Tables("总分类账") Dim qj As String = Vars("会计期间") Dim strs1() As String = {"货币资金"} Dim strs2() As String = {"strs2(1)"} Dim x() As String = {"0"} Dim y() As String = {"6"} \'会计科目中提取\'货币资金\'的科目代码 For i As Integer = 0 To strs1.Length-1 Dim lst As List(of String) = DataTables("会计科目").GetValues("科目代码","资产负债表 like \'" & strs1(i) & "%\' or 资产负债表 like \'%" & strs1(i) & " \'") Dim str As String For Each ids As String In lst str & = ids & "," Next \'msgbox(1) str = str.Trim(",") \'msgbox(2) Dim n As Double = tb2.DataTable.sqlCompute("sum(余额)","科目代码 in (" & str & ") And 摘要 = \' 本 年 累 计\' and 会计期间 = \'" & Vars("会计期间") & "\' ") \'msgbox(3) tb(CInt(x(i)),CInt(y(i)))=n \'msgbox(4) \'output.show(strs2(i)) Next 问题:当 strs1() 数组 有多少值 时,得到的最后:双精度小数,n,(例:第一个N为N1,第二N为N2,) 如何,进行最想N1 的值 -减去 N2的值 ;等运算操作?
|
-- 作者:有点甜 -- 发布时间:2017/10/8 16:38:00 -- 用一个变量记录上一个的值
Dim pn As Double = 0 For i As Integer = 0 To strs1.Length-1
Dim n As Double = tb2.DataTable.sqlCompute("sum(余额)","科目代码 in (" & str & ") And 摘要 = \' 本 年 累 计\' and 会计期间 = \'" & Vars("会计期间") & "\' ") msgbox(n & " " & pn) pn = n |
-- 作者:有点甜 -- 发布时间:2017/10/8 16:39:00 -- 你也可以用一个集合,把所有的n都添加进去,想怎么取都可以
http://www.foxtable.com/webhelp/scr/0217.htm
|