Filter data table wizard with array /List

Hi , my question how can you use the filter data table wizard with array or list?

I have a column “workercode” and i want to filter that column based on a array called code.


welcome to the forum

give try on following and use within an assign activity following:

(From r in yourDataTableVar.AsEnumerable
From s In yourFilterTokenArrayVar
Where r(“workercode”).toString.Contains(s)
Select r).CopyToDataTable

EDITED: Alternate to the cartesian product approach

(From r in yourDataTableVar.AsEnumerable
Where yourFilterTokenArrayVar.Any(Function (x) r(“workercode”).toString.Contains(x))
Select r).CopyToDataTable

We check if the workercode is contained in the string of any item from the array/list


(From r in yourDataTableVar.AsEnumerable
Where yourFilterTokenArrayVar.Contains(r(“workercode”).toString.Trim))
Select r).CopyToDataTable

We check of there is any item in the array/list which have the same value as the workercode value


You Can not directly use an array or list inside the filter wizard. But you can achieve this using linq-
dtInputData.AsEnumerable().where(Function(s) code.Any(function(t) s(“Status”).tostring.Contains(t))).FirstOrDefault()

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.