以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  筛选行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=124209)

--  作者:yangwenghd
--  发布时间:2018/9/2 0:01:00
--  筛选行
能帮忙看看这短代码吗

设置筛选的两个条就是 债权人的最后一行的分别欠款不为0的,第二只筛选出相同债权人的最后一行,
比如债权人有a和b 还有c 其中债权人为a的欠款明细追后一行为0,那么债权人为a的都不显示,
剩下的只显示最后一行,比如b和c最后一行不为0,那么只显示b和c的最后行,感谢 感谢 



Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "债权人"
For Each dr As DataRow In DataTables("欠款明细").Select("", cs)
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c).replace(" ","") <> dr(c).replace(" ", "") Then
                flag = True
                Exit For
            End If
        Next
        If flag Then
            If pdr("欠款明细") <> 0 Then
                idx &= pdr("_Identify") & ","
            End If
        End If
    End If
    pdr = dr
Next
If pdr IsNot Nothing Then
    If pdr("欠款明细") <> 0 Then
        idx &= pdr("_Identify") & ","
    End If
End If
e.Form.controls("Table6").Table.Filter = "_Identify In (" & idx.trim(",") & ")"


--  作者:有点甜
--  发布时间:2018/9/2 11:20:00
--  

For Each dr As DataRow In DataTables("欠款明细").Select("", cs)

 

改成

 

For Each dr As DataRow In DataTables("欠款明细").Select("", cs & ", _Identify desc")

 

如果还有问题,上传一个实例测试。


--  作者:yangwenghd
--  发布时间:2018/9/2 21:13:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:筛选.table

还是不对呢?感谢 感谢,第一列不同的内容的最后一行都是0理论上都一个隐藏,但是筛选的时候还是被筛选出了,感谢 感谢

图片点击可在新窗口打开查看此主题相关图片如下:搜狗截图18年09月02日2110_1.png
图片点击可在新窗口打开查看


--  作者:有点甜
--  发布时间:2018/9/2 23:21:00
--  
Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列"
\'For Each dr As DataRow In DataTables("欠款明细").Select("", cs)
For Each dr As DataRow In DataTables("表A").Select("", cs & ", _Identify")
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c)<> dr(c) Then
                flag = True
                Exit For
            End If
        Next
        If flag Then
            \'msgbox(pdr("第一列") & " " & pdr("第二列") & " " & dr("第二列") & " " & dr("第一列"))
            If pdr("第二列") <> 0 Then
                idx &= pdr("_Identify") & ","
            End If
        End If
    End If
    pdr = dr
Next
If pdr IsNot Nothing Then
    If pdr("第二列") <> 0 Then
        idx &= pdr("_Identify") & ","
    End If
End If
e.Form.controls("Table1").Table.Filter = "_Identify In (" & idx.trim(",") & ")"