以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]下拉列表框显示不重复的列内容  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=105030)

--  作者:xh2207
--  发布时间:2017/8/10 13:18:00
--  [求助]下拉列表框显示不重复的列内容
如何修改,请指教并详细贴出代码,小狗到期无法升级了。非常感谢!
图片点击可在新窗口打开查看此主题相关图片如下:到货入仓.png
图片点击可在新窗口打开查看
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1_201708101311.zip


--  作者:有点甜
--  发布时间:2017/8/10 15:06:00
--  

DropDownOpened

 

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("未到货数量>0", 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 count > 1 Then
                idx &= idx_temp
            End If
            count = 1
            idx_temp = ""
        Else
            count += 1
            idx_temp &= dr("_Identify") & ","
        End If
    Else
        count += 1
    End If
    pdr = dr
Next
If count > 1 Then
    idx &= idx_temp
End If

e.Form.controls("Table1").Table.Filter = "未到货数量>0 and _Identify not In (" & idx.trim(",") & ")"


--  作者:xh2207
--  发布时间:2017/8/10 15:32:00
--  

感谢!有点甜。


--  作者:xh2207
--  发布时间:2017/8/10 17:45: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("未到货数量>0   or  isnull(未到货数量)", 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 count > 1 Then
                idx &= idx_temp
            End If
            count = 1
            idx_temp = ""
        Else
            count += 1
            idx_temp &= dr("_Identify") & ","
        End If
    Else
        count += 1
    End If
    pdr = dr
Next
If count > 1 Then
    idx &= idx_temp
End If

e.Form.controls("Table1").Table.Filter = "未到货数量>0 or isnull(未到货数量)   and _Identify not In (" & idx.trim(",") & ")"


--  作者:xh2207
--  发布时间:2017/8/10 17:48:00
--  

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

--  作者:有点甜
--  发布时间:2017/8/10 18:17:00
--  
e.Form.controls("Table1").Table.Filter = "(未到货数量>0 or 未到货数量 is null)   and _Identify not In (" & idx.trim(",") & ")"
[此贴子已经被作者于2017/8/10 18:17:26编辑过]