Check partial content

Hello!
I have DT: Безымянный

I need: IF in column1 has “hello” - take number from column 2
FOR EACH ROW
IF (“hello”)
{What do where??} I need get 2,3,4 rows

ForEach datarow in DT.AsEnumerable().AsQueryable().Where(Function(x) x(“Column1”).ToString.Contains(“hello”))

1 Like

pls use the For Each Row activity and pass the datatable as input
inside foreach row activity add if activity and add condition like if(item(“column1”).ToString.Contains(“hello”)
True section
you can write item(“COLUMNNAME”).ToString to get the column info

What if I haven’t columnName? I write: DT.AsEnumerable().AsQueryable().Where(Function(x) x(0).ToString.Contains(“hello”))
And catch error:
For Each: An ActivityContext can only be accessed within the scope of the function it was passed into.
Object name: ‘System.Activities.CodeActivityContext’.

It’s get only " hello"
Not “afjeoqif hello” - but I need it too

Use ForEach activity on

DT.AsEnumerable().AsQueryable().Where(Function(x) x(0).ToString.Contains("hello")

(type is DataRow)

I did it, and catch:
For Each: An ActivityContext can only be accessed within the scope of the function it was passed into.
Object name: ‘System.Activities.CodeActivityContext’.

Build DataTable as DT

image

Workflow
with an example of output on the fly of the column1 content
with a ForEach loop outputting the content of each filtered column2

image

Details of the log activity

image

Details of the ForEach activity

Output

image

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