Hi
I m trying to find a more effective way to do the filtering.
dt.AsEnumerable.Where(function(r)stringArry.Contains(r(“ColumnName”).ToString())).CopyToDataTable()
but i want to add 4 more condtions on it. for example
dt.AsEnumerable.Where(function(r)stringArry.Contains(r(“ColumnName”).ToString() AND (x(“Column2”).Equals(“”) and (x(“column3”).equals(“”) AND anotherStringofarray)
how do i achieve with one line of code? I tried. select as well but didn’t really work
Any advice.
Thanks
DT.AsEnumerable().Where(Function(row) stringArry.Contains(row(“ColumnNam0”).ToString()) AND row(“ColumnNam1”).ToString().Equals(“ABC”) AND row(“ColumnNam2”).ToString().Equals(“XYZ”) ).CopyToDataTable()
it will work - however contains is the slowest section in the linq part…
Do you have any suggestion to achieve it with most effective way ? and faster way ?
I don’t want to use filter table activity as we may get more string to add in the array/list.
If you want to filter datatable by dynamic multiple condition with single line, the following might help you, for example.
You can just add dictionary item if you want to add condition.
I was going to close it but i want to know if i can use Equal rather than contains for each of the array list ? I tried changing to .Equals. but not working as expected