Foxtable(狐表)用户栏目专家坐堂 → 数据 变量 计算


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

主题:数据 变量 计算

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


加好友 发短信
等级:幼狐 帖子:69 积分:617 威望:0 精华:0 注册:2016/10/26 10:41:00
数据 变量 计算  发帖心情 Post By:2022/7/15 23:22:00 [显示全部帖子]

求教,错在哪,很菜,不好意思。
我试过可以增加一个列,赋值后在表达示列里计算,不过想试着不增加数据列计算

Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim d As Integer = Date.Today.Day
Dim dt1 As New Date(y, m, 1)
Dim dt2 As New Date(y, m, d)
Dim d3 As New Date(y, m, d)
Dim dt3 As Date = d3.AddDays( - 1) '减去1天
Dim memory1 As Double = DataTables("日").Compute("库存量", "[日期] = #" & dt2 & "#")
Dim memory2 As Double = DataTables("日").Compute("库存量", "[日期] = #" & dt3 & "#")
Dim memory As Double = memory1 - memory2
DataTables("日").ReplaceFor("库存量差值", memory, "[日期] = #" & dt2 & "#")

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


加好友 发短信
等级:幼狐 帖子:69 积分:617 威望:0 精华:0 注册:2016/10/26 10:41:00
  发帖心情 Post By:2022/7/16 7:02:00 [显示全部帖子]

自己回答吧,写少了一个sum
这个通过,看看可以改简单一些吗
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month
Dim d As Integer = Date.Today.Day
Dim dt1 As New Date(y, m, 1)
Dim dt2 As New Date(y, m, d)
Dim d3 As New Date(y, m, d)
Dim dt3 As Date = d3.AddDays( - 1) '减去1天
Dim memory1 As Double = DataTables("日").Compute("Sum(库存量)", "[日期] = #" & dt2 & "#")
Dim memory2 As Double = DataTables("日").Compute("Sum(库存量)", "[日期] = #" & dt3 & "#")
Dim memory As Double = memory1 - memory2
DataTables("日").ReplaceFor("库存量差值", memory, "[日期] = #" & dt2 & "#")

 回到顶部