Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]调用函数并筛选结果不符合

1楼
lgj716330 发表于:2025/3/10 12:14:00
首先有个总表,如下
1、定义总表的筛选条件,函数名FilterNY5
Dim e = Args(0)
Dim N1 As Integer = e.Form.Controls("NF1").value
Dim n2 As Integer = N1 - 1
Dim n3 As Integer = N1 - 2
Dim Y1 As Integer = e.Form.Controls("YF1").value
Dim Y2 As Integer = e.Form.Controls("YF2").value
Dim FilterNY5 As String = "年份=" & n2 & " OR 年份=" & n3 & " OR (年份=" & n1 & " and 月份>=" & y1 & " and 月份<=" & y2 & ")"
Return FilterNY5
2、汇总表,函数名为”零售汇总“
Dim e = Args(0)
Dim FilterNY5 As String = Functions.Execute("FilterNY5", e)
Dim b As New SQLJoinTableBuilder("零售汇总", "核算汇总表")
b.C
b.AddCols("{核算汇总表}.*")
b.Filter = "" & FilterNY5 & " and 实销金额<>0"
b.Build()

上述查询没有问题
然后对总表进行筛选
1、筛选条件函数,函数名为”跨年时间筛选bq“
Dim e = Args(0)
Dim N1 As Integer = e.Form.Controls("NF1").value
Dim N2 As Integer = e.Form.Controls("NF2").value
Dim Y1 As Integer = e.Form.Controls("YF1").value
Dim Y2 As Integer = e.Form.Controls("YF2").value
Dim FilterKNY As String
If N2 > N1 Then
    FilterKNY = "(年份=" & N1 & " and 月份 >= " & Y1 & ") or (年份=" & N2 & " and 月份 <= " & Y2 & ")"
ElseIf N2 = N1 Then
    FilterKNY = "(年份=" & N1 & " and 月份 >= " & Y1 & " and 月份 <= " & Y2 & ")"
End If
Return FilterKNY

2、筛选统计下如
Dim FilterKNY As String
Functions.Execute("零售汇总", e)
Functions.Execute("跨年时间筛选bq", e)
msgbox(FilterKNY)
Tables("零售汇总").Filter = FilterKNY

MainTable = Tables("零售汇总")

首先这里的msgbox(FilterKNY)显示是空值,然后筛选结果出来了FilterKNY范围内及以前年份的数据,比如筛选2024年3-5月,会出来24年3-5月及24年之前的数据,24年5月之后的数据有限制住了。不知哪里问题

[此贴子已经被作者于2025/3/10 12:31:58编辑过]
2楼
有点蓝 发表于:2025/3/10 13:39:00
Dim FilterNY5 As String = Functions.Execute("FilterNY5", e)
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.