Hi all,
I am trying to filter the data table using an array of string. none of the solutions in the forum seem to be working.
I want to do 2 filter
One contains
and one not contain.
want to avoid using data table filter activity.
Thanks all ![]()
Hi all,
I am trying to filter the data table using an array of string. none of the solutions in the forum seem to be working.
I want to do 2 filter
One contains
and one not contain.
want to avoid using data table filter activity.
Thanks all ![]()
Hi,
How about the following expressions?
One contains
dt = dt.AsEnumerable.Where(function(r) yourStringArray.Contains(r("ColumnName").ToString())).CopyToDataTable()
and one not contain.
dt = dt.AsEnumerable.Where(function(r) not yourStringArray.Contains(r("ColumnName").ToString())).CopyToDataTable()
Regards,
I tried that , but it wont allow me to put on boolean.
Hi,
Is there any error?
Can you share your data and what you expect in details?
Regards,
No, there’s no error but i want to use that condition in flow decision or IF statement. but it’s saying data table can’t convert to boolean and if i remove copytodt then its saying can’t convert dt row to boolean
Hi,
How about the following? It returns true if there is one or more item which match with one of your string array.
hasContains = dt.AsEnumerable.Any(function(r) yourStringArray.Contains(r("ColumnName").ToString()))
Regards,
thanks that work. i was missing extra () when i tried it.
I m having this eorror for " The source contains no DataRows. "
Thanks
Yes , i m trying to seperate the datatable.
Sometime i could come with zero row and sometime it could be mixed.
Dont want to use filter table as i would have to hard code the filtering.
IF there’s no row i want to just assign nothing. so dt.clone won’t do for me