Hi All,
I want to replace “Failed” value with “error” in status row using LINQ query …below is my Data table …can someone please help ?
Thanks,
Naresh
Hi All,
I want to replace “Failed” value with “error” in status row using LINQ query …below is my Data table …can someone please help ?
Thanks,
Naresh
Please use the following query in the Invoke Code activity:
io_dt.AsEnumerable.ToList.ForEach(Sub(row)
row("Status") = If(row("Status").ToString.ToLower.Equals("failed"),"Error",row("Status").ToString)
End Sub)
Hope this helps,
Best Regards.
@arjunshenoy can’t we use LINQ query thru assign ?
have a look on the different options
How to Update Data Column Values of a Data Table | Community Blog
whenever we want to use a statement within an assign activity we have to ensure, that each part within the statement is returning a value, This was done with the DataTable Reconstruction approach.
setField method / selective data column value update will not return a value. So we use the invoke code
I tried this but it is not working
Initial DT
Invoke code
below result after invoke code → No change in status (Failed is not replaced with error )
→ PFB xaml file and report input file
Rename.xaml (5.7 KB)
Report.xlsx (545.2 KB)
Note : Sometimes we may not have status with Failed … linq may fail in this kind of scenarios ?
is there possibilities that Linq should work incase If we don’t have Failed records in status ?
In the query, since you are converting row(“Status”) to lower case using .ToLower, you must be comparing the data with ‘failed instead of ‘Failed’. Please Change it to ‘failed’ & let us know if it works.
Best Regards.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.