I have a DT I want to filter using the following code
db_in.Select(“[NAME] NOT IN (” +r1_1+ “) AND [VALUE] NOT IN (” + r1_2 +“)”).CopyToDataTable
the variables r1_1 and r1_2 contains strings of multiple values, so I’m not able to use Filter Data Table.
My issue is that I have a table that contains the values A, B, C and D (NAME) and Values 1,2,3 and 1, where the variable r1_1 contains A, B and C and r1_2 contains 1,2,3. By my reckoning, the code above should filter all values except for D 1. However, it filter D 1 as well, so it seems the AND operator isn’t really working, it’s just filtering based on both variables individually. Any suggestions?
I do work more with LINQ as wit the select
But I would give a try on
db_in.Select(“[NAME] NOT IN ('” +r1_1+ “') AND [VALUE] NOT IN ('” + r1_2 +“')”).CopyToDataTable
so I just inclued ’ before " +r1_1 and on the end, similar to r1_2
If hint is not helping so just provide some sample data or the xaml and we can faster work on it, Thanks
These are my files. The rules file is read at the begining, and the input data is the data I want filtered according to the rules specified. Thanks so much for helping out.
@mickeymack
There are some minor issues, but for sure solveable.
Unfortuately i do come to the same conclusion all rows and its values from input_data are contained in r1, r2 so returned DataTable is empty
A 1 is in ABCD, 1 is 123456789
B 2
C 3
D 1
I’ve checked, and it seems to be working like this:
A 1 - A is in A,B,C and 1 is in 1,2,3, so A 1 is removed. OK
B 2 - B is in A,B,C and 2 is in 1,2,3, so B 2 is removed. OK
C 3 - C is in A,B,C and 3 is in 1,2,3, so C 3 is removed. OK
D 1 - D is not in A,B,C, and 1 is in 1,2,3, so for some reason I cannot get it is removed. NOT OK