I have a data table that I wish to Filter based on a list of Customer values. Instead of listing each customer value separately, how would I code the Filter to use “Contains” and place customer values in a List.
You can achieve this using Assign activity with the IN condition in DataTable.Select() method
dt_Input.Select(“[Customer] in (‘70025369’,‘70025371’,‘70025373’,‘70025375’)”).CopyToDataTable
If you have filter values in Array or List then, you can use the String.Join() to pass value and that will make the query dynamic.
dt_Input.Select(“[Customer] in (”+String.Join(“,”,dt_Input)+“)”).CopyToDataTable
Thanks
John
Hi,
Another approach with LINQ :
arrCustomerValue = {"70025369","70025524","70026089","30052501".......}
Then
PD9_Download_Case = PD9_Download_Case.AsEnumerable.Where(Function(r) arrCustomerValue.Contains(r("Customer").ToString)).CopyToDataTable()
Regards,
1 Like
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.