Foxtable(狐表)用户栏目专家坐堂 → [求助]后台数据统计


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

主题:[求助]后台数据统计

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


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
[求助]后台数据统计  发帖心情 Post By:2018/1/28 14:04:00 [显示全部帖子]

老师你好!
我原来在项目中设置了按窗口控件条件筛选数据,如下图:

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20180128140546.png
图片点击可在新窗口打开查看

开始按钮中的代码为:
Dim Filter As String
With e.Form.Controls("CheckedComboBox2")
    If .Value IsNot Nothing Then
         Filter = "所属省份 in ('" & .Value.Replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("CheckedComboBox1")
    If .Value IsNot Nothing Then
         Filter = "项目类型 In ('" & .Value.Replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "施工区域 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "最大承载力KN >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "最深桩长m >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox4")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "最大桩径mm >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox5")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "基坑深度m >= '" & .Value & "'"
    End If
End With

With e.Form.Controls("NumericComboBox1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "工程造价 >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "开工日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "竣工日期 <= #" & .Value & "#"
    End If
End With
If e.Form.Controls("在建工程").Checked = True ' 如果选择了"在建工程"
         If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "竣工日期 >= #" & Date.Today & "#" 
End If
If Filter > "" Then
    Tables("工程技术参数").Filter = Filter
End If
Dim t As Table = Tables("工程技术参数")
Dim n As Integer = t.DataTable.GetValues("合同编号", t.filter).count
Dim lbl As WinForm.Label
lbl = e.Form.Controls("Label5")
lbl.Text = "符合条件工程数:" & n & "个," & "记录数:" & Tables("工程技术参数").Rows.Count & "条."

现在我的项目是按照条件加载数据,以上代码是按照已加载数据执行,需要按照后台数据筛选,代码应该怎么改?
谢谢老师!
[此贴子已经被作者于2018/1/28 14:07:50编辑过]

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


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
  发帖心情 Post By:2018/1/29 10:04:00 [显示全部帖子]

老师还是不行,代码改后还是和原来一样,没有显示未加载数据。
另外我这个表是和“工程合同基础数据”(主表)有关联,有表达式列公式。
是不是要生成一个临时表,再生成?
谢谢!
[此贴子已经被作者于2018/1/29 10:06:15编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
沪上游客
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
  发帖心情 Post By:2018/1/29 11:56:00 [显示全部帖子]

老师还是不行

 回到顶部
帅哥哟,离线,有人找我吗?
沪上游客
  4楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
  发帖心情 Post By:2018/1/29 12:53:00 [显示全部帖子]

老师你好!我已发邮件给您了,请查收帮我看一下整个项目有什么问题?谢谢!

 回到顶部
帅哥哟,离线,有人找我吗?
沪上游客
  5楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
  发帖心情 Post By:2018/1/29 13:05:00 [显示全部帖子]

老师你好!能给个QQ吗?传不上,文件太大了。

 回到顶部
帅哥哟,离线,有人找我吗?
沪上游客
  6楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:266 积分:2150 威望:0 精华:0 注册:2012/3/28 16:49:00
  发帖心情 Post By:2018/1/29 15:23:00 [显示全部帖子]

Dim Filter As String
With e.Form.Controls("CheckedComboBox2")
    If .Value IsNot Nothing Then
        Filter = "所属省份 in ('" & .Value.Replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("CheckedComboBox1")
    If .Value IsNot Nothing Then
        Filter = "项目类型 In ('" & .Value.Replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("TextBox2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "施工区域 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "最大承载力KN >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox3")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "最深桩长m >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox4")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "最大桩径mm >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox5")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "基坑深度m >= '" & .Value & "'"
    End If
End With

With e.Form.Controls("NumericComboBox1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "工程造价 >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "开工日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "竣工日期 <= #" & .Value & "#"
    End If
End With
If e.Form.Controls("在建工程").Checked = True ' 如果选择了"在建工程"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "竣工日期 >= #" & Date.Today & "#"
End If
If Filter > "" Then
    Tables("工程技术参数").DataTable.LoadTop = Nothing
    Tables("工程技术参数").DataTable.LoadFilter = ""
    Tables("工程技术参数").DataTable.Load
End If
Dim t As Table = Tables("工程技术参数")
Dim n As Integer = t.DataTable.GetValues("合同编号", t.filter).count
Dim lbl As WinForm.Label
lbl = e.Form.Controls("Label5")
lbl.Text = "符合条件工程数:" & n & "个," & "记录数:" & Tables("工程技术参数").Rows.Count & "条."

 回到顶部