Rss & SiteMap

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

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

标题:[求助]多条件统计

1楼
苏州老街 发表于:2025/3/30 16:25:00
老师好,我想在“房屋主体”后面再加一个统计条件“单间名称”


If e.DataCol.name = "年" OrElse e.DataCol.name = "房屋主体" Then
    If e.DataRow.Isnull("年") = False AndAlso e.DataRow.Isnull("房屋主体") = False Then
        Dim filter1 As String = "名称_房屋主体 = '" & e.DataRow("房屋主体") & "'"
        For i As Integer = 1 To 12
            Dim d As Date = new Date(val(e.DataRow("年")), i, 1)
            Dim sum As Integer = DataTables("租房数据汇总").compute("sum(累计缴费)", filter1 & " and 抄表日期 >= #" & d & "# and 抄表日期 < #" & d.addmonths(1) & "#")
2楼
有点蓝 发表于:2025/3/30 20:47:00
用法不都一样吗,使用and连接多个条件即可:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=196048&skin=0
3楼
苏州老街 发表于:2025/3/31 4:44:00
老师,这个统计条件“单间名称”要加到下面代码中吗?

If e.DataCol.name = "年" OrElse e.DataCol.name = "房屋主体" Then
    If e.DataRow.Isnull("年") = False AndAlso e.DataRow.Isnull("房屋主体") = False Then
        Dim filter1 As String = "名称_房屋主体 = '" & e.DataRow("房屋主体") & "'"
4楼
有点蓝 发表于:2025/3/31 8:40:00
要加
5楼
苏州老街 发表于:2025/3/31 13:55:00
老师,没有改好,标出的是原来的代码,没标出的代码该不好。

'If e.DataCol.name = "年" OrElse e.DataCol.name = "单间名称" Then
    'If e.DataRow.Isnull("年") = False AndAlso e.DataRow.Isnull("单间名称") = False Then
        'Dim filter1 As String = "名称_单间名称 = '" & e.DataRow("单间名称") & "'"


If e.DataCol.name = "年" OrElse e.DataCol.name = "房屋主体"  OrElse e.DataCol.name = "单间名称" Then
    If e.DataRow.Isnull("年") = False AndAlso e.DataRow.Isnull("房屋主体") AndAlso e.DataRow.Isnull("单间名称") = False Then
        Dim filter1 As String = "名称_房屋主体 = '" & e.DataRow("房屋主体") And "名称_单间名称 = '" & e.DataRow("单间名称") & "'"

6楼
有点蓝 发表于:2025/3/31 14:02:00
.....e.DataRow("房屋主体") And 名称_单间 ...
7楼
苏州老街 发表于:2025/3/31 14:19:00
老师,是这个地方面


 Dim filter1 As String = "名称_房屋主体 = '" & e.DataRow("房屋主体") And "名称_单间名称 = '" & e.DataRow("单间名称") & "'"

8楼
有点蓝 发表于:2025/3/31 14:21:00
多个双引号
9楼
苏州老街 发表于:2025/3/31 14:28:00
老师,去掉双引号报错

图片点击可在新窗口打开查看此主题相关图片如下:2025-03-17 12 19 54.png
图片点击可在新窗口打开查看
10楼
有点蓝 发表于:2025/3/31 14:30:00
Dim filter1 As String = "名称_房屋主体 = '" & e.DataRow("房屋主体") & "' And 名称_单间名称 = '" & e.DataRow("单间名称") & "'"
共17 条记录, 每页显示 10 条, 页签: [1] [2]

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

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