I’m trying to filter the DataTable by taking parameters.
Assume that there are values 1,2,3,4,5 in the column called Number in the datatable named BerforeDT. Then, when I want to leave only 1, 3, and 5, I try to use this as a parameter.
But when I put {1,3,5} in the DataTable filter, it doesn’t work…
How can I filter multiple values?
Thank you! I’m doing what you said and it’s going well!
Can you explain to me ‘dt.AsEnumerable.Where(Function(r) arrInt.Contains(Int32.Parse(r(“Number”).ToString))).CopyToDataTable’?
How was it filtered?
Thanks again!
dt.AsEnumerable returns IEnumerable<DataRow> and Where method is for filtering IEnumerable<DataRow> by condition described in it. Function(r) means iterate each datarow as variable r.
The condition is arrInt.Contains(Int32.Parse(r(“Number”).ToString))
This checks whether arrInt : in this case {1,3,5} contains item of Number Column in the datarow. If contains, the datarow will be kept and if not, will be filtered out.
I just confirmed Thanks for explaining!
Is there any way I can use this method to use the activity?
If the value in { } is not fixed, is the only way to use Assign?