I need to update all the cell values of a particular column to Nothing if the length of that particular string is greater than 200
I need to achieve this using LINQ. Since the excel data has more than 15000 records in it.
Any helps or leads are much appreciated.
Let’s say your input DataTable is InputDT
Try below expression in Invoke Code activity to do that.
InputDT.AsEnumerable().ToList().ForEach(Sub(row) row(“ColumnName”) = If(row("ColumnName").ToString.Trim.Length > 200, "Nothing", row("ColumnName").ToString.Trim)
Note: Create one argument for Invoke Code activity and mention properties as below.
Name - InputDT
Direction - In
Type - DataTable
Value - InputDT
Hi @lakshman , Thank you for replying to my post.
Your expression is working.
Hi @lakshman, I tried your expression in my local machine and it is working fine. And when I tried the same expression in my development environment. I get the following error
invoke code: Exception has been thrown by the target of an invocation.
Do you have any clues what the possible cause of this error.
This error usually occurs when trying to pass null value to the argument. Can you print the DataTable row count before Invoke code activity to check whether it contains any value or not.
the row count is 10082, even though I get the same error.
Is there an empty values in that column ?
it is working fine now. I have placed the invoke code activity at the wrong place.
Thank you so much @lakshman for the help.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.