Filter datatable with array of string variable

Hi,

i have array of string variable,

How to filter datatable with the array string variable,

I would like to avoid filter data table activities since there is lot of string i need to filter.

Thanks

1 Like

Hey @mashy2,

-Create a datatable and dont forget to initialize the datatable.Let’s say DT.
-Iterate your string array using foreach and inside the foreach use the statement below:

DT.Select("[ColumnName]=’"+item.Tostring()+"’").CopyToDatatable(DT,LoadOption.PreserveChanges)

May i know why it gave output: Expression does not produce any value

Hey @mashy2,

A Little correction Here:

DT.Select("[ColumnName]=’"+item.Tostring()+"’").CopyToDatatable(DT1,LoadOption.PreserveChanges)

The datatable in the copytodatatable should be different.

1 Like

In the Assign activity, you need to have the datatable in “To” field different with the datatable being filtered in “Value” field.

1 Like

Hi,
Same error produce:

1 Like

Hey @mashy2,

Use this inside invoke code and pass the input and output argument.

This error is being generated because you are copying and assigning the values to the same datatable.

1 Like

do u got sample code?
:slight_smile:

1 Like

Pls remove this part from your “Value” field: after_filter,LoadOption.PreserveChanges

1 Like

This wont work since it will check only column name not its item matching to the array.