Victor Charles
asked on
Help with filtering data in a table
Hi,
This is a follow up to the following case:
https://www.experts-exchange.com/questions/27827475/Help-with-creating-multiple-tables-within-a-For-next-Loop.html?anchorAnswerId=38307414#a38307414
when NSN_ID in my linkssadb file contains the same data (listed below), I receive 4 rows from LinkAID = 1 and LinkAID = 2 in my list box instead of only for data for LinkAID = 1. Is there a way to filter by LinkAID instead of NSN_ID?
I tried changing the filter from NSN_ID to LinkAID:
MsgBox("keyNsn" & keyNsn)
Dim _table As DataView = dtMaster.DefaultView
_table.RowFilter = "LinkAID in (" & keyNsn & ")"
C1NSN.DataSource = _table
C1NSN.DataTextField = "NSN"
C1NSN.DataValueField = "NSN_ID"
C1NSN.DataBind()
but it does not work.
Linkssadb.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<LinkA>
<LinkAID>0</LinkAID>
<Fuze_ID>0</Fuze_ID>
<NSN_ID>0</NSN_ID>
</LinkA>
<LinkA>
<LinkAID>1</LinkAID>
<Fuze_ID>1</Fuze_ID>
<NSN_ID>1,2</NSN_ID>
</LinkA>
<LinkA>
<LinkAID>2</LinkAID>
<Fuze_ID>1</Fuze_ID>
<NSN_ID>1,2</NSN_ID>
</LinkA>
</Root>
This is a follow up to the following case:
https://www.experts-exchange.com/questions/27827475/Help-with-creating-multiple-tables-within-a-For-next-Loop.html?anchorAnswerId=38307414#a38307414
when NSN_ID in my linkssadb file contains the same data (listed below), I receive 4 rows from LinkAID = 1 and LinkAID = 2 in my list box instead of only for data for LinkAID = 1. Is there a way to filter by LinkAID instead of NSN_ID?
I tried changing the filter from NSN_ID to LinkAID:
MsgBox("keyNsn" & keyNsn)
Dim _table As DataView = dtMaster.DefaultView
_table.RowFilter = "LinkAID in (" & keyNsn & ")"
C1NSN.DataSource = _table
C1NSN.DataTextField = "NSN"
C1NSN.DataValueField = "NSN_ID"
C1NSN.DataBind()
but it does not work.
Linkssadb.xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
<LinkA>
<LinkAID>0</LinkAID>
<Fuze_ID>0</Fuze_ID>
<NSN_ID>0</NSN_ID>
</LinkA>
<LinkA>
<LinkAID>1</LinkAID>
<Fuze_ID>1</Fuze_ID>
<NSN_ID>1,2</NSN_ID>
</LinkA>
<LinkA>
<LinkAID>2</LinkAID>
<Fuze_ID>1</Fuze_ID>
<NSN_ID>1,2</NSN_ID>
</LinkA>
</Root>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works!
Thanks!
Victor
Thanks!
Victor
ASKER
As an alternate solution, how do you also avoid duplicate rows in a listbox?
V.