Hope the below expression would help you resolve this
You need to write expression in Invoke Code activity.
dt.AsEnumerable().Where(Function(a) NOT a.Field(of String)(“Company Code”).ToString.Equals(“A”) AND NOT a.Field(of String)(“Company Code”).ToString.Equals(“B”) AND NOT a.Field(of String)(“Company Code”).ToString.Equals(“C”) AND NOT a.Field(of String)(“Company Code”).ToString.Equals(“D”)).ToList().ForEach(Sub(row) row(“Status”) = “Not Required”).CopyToDataTable()
Note: Create one argument for Invoke Code activity and mention properties as below.
Name - dt
Direction - In
Type - DataTable
Value - dt
@Yoichi
I worked with this sample and its fine as below:
DT.AsEnumerable().Where( r => !ArrCompanyCodes.Contains( r.Field(“Company Code”))).Select(r => r[“Status”]=“Not Required”).ToList() ;
What if we need to update multiple columns. I tried as below but showing error while passing multiple arg in Select :
DT.AsEnumerable().Where( r => !ArrCompanyCodes.Contains( r.Field(“Company Code”))).Select(r => r[“Status”]=“Not Required”; r[“Remarks”]=“Comapny code not correct”).ToList() ;
@Yoichi
Thanks a lot it worked.
Can you also please help me with last query. I want to filter my Datatable using DT.Select in Assign statement which is filtered based on array of string. I do not want to use OR statements as I want comparison values coming from config.
I have a similar scenario but I want to put multiple conditions for different columns in where condition.
Below it the scenario for your reference where threshold is of type Double :