Error while using the data table argument in invoke code activity


Am trying to update the multiple rows from data table when it meets the specific condition. but am getting below error . Please assit.

SampleDt.Select(“Col1='”+value+“”).ToList().ForEach(Sub (row) row(“col2”=“test”))

SampleDt - argument (datatable - type in)
value - argument (string - type in)

error : attached screenshot.

Hi @Fresher

Please try below,

SampleDt.Select(“Col1=’”+value+“”).ToList().ForEach(Sub (row) row(“col2”)=“test”)

And also try changing the argument from in to in/out.


1 Like

How to Update Data Column Values of a Data Table | Community Blog

it is listing your case


Hello @ppr - Thanks for the link, its really useful one!!

dtData.AsEnumerable.Where(Function (x) x(“TEAM”).ToString().Trim().StartsWith(teamFilter)).ToList

this expression will solve my query by adding the for each row activity, However could you please help to build the vb code using the invoke code activity.

@prasath_S - Thanks for your input, with that complier error is gone and but am getting target invocation error and am sure all the argument has the proper value in it.

Would be grateful if you can share some sample xaml to cross verify with mine.

it’s just about mirroring the same to the invoke code

For Each row As Datarow In dt.AsEnumerable.Where(Function (x) x("Col1").toString.Equals(myValue).toList
    row("col2") = "test" 

In LINQ you need to use the Where operator to do the filtering

About the arguments just respect datatype and directions
Avoid that parameter/argument name is the same as the variable
Avoid names similar to class names, method names or other Keywords

working with the Select method have a clear handling of the string surrounding ’

SampleDt.Select("Col1='<-"+value+"->').ToList().ForEach(Sub (row) row("col2") = "test")

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