Facing below error,
for general introduction
for a first analysis / selection approach we would recommend also, to check how many rows are affected. (Just use a count statement)
Then lets decide, which approach will fit the best
Yeah you should replace dt1 with your data table contains those 83 columns.
Tried invoke code and getting the error screenshot which is pasted in the thread
Tried linq but here manually I have to pass all the column names
Cant use for each as I have 40k records of data
NOTE: there are around 1000 rows in each column, which has -241 value, I have to change it to 0
For me i am not getting any error the code is working fine. i think the error is due to UiPath.System.Activities package is older version i guess. if you have older version could you pls upgrade to latest. Please note that before doing all this pls take back up of your project and do all these changes.
After upgrade to latest try execute that invoke code activity. thanks
I think there needs to be some imports done
I have only one extra package other than default packages. that is below
Hello Shilpa and Prasath,
I just tried the code sequence and it works fine for me, for Windows - Legacy and Windows mode, with UiPath Studio 2021.10.2.
The class Microsoft.CodeAnalysis.SyntaxTree with the method ParseText is part of the Roslyn compiler. It is part of the Studio installation and in a normal case I would never expect this kind of error.
Here as example my two test cases, please try it and let us know your results.
ShilpaTestWindows.zip (99.9 KB)
ShilpaTestWindowsLegacy.zip (56.6 KB)
Extract this files in your C:\Users[YourUserName]\Documents\UiPath folder and open the project file from the front page of the UiPath Studio. Does the exclamation mark appear in the upper right corner of the Invoke Code activity?
I can just reproduce this problem in my environment as the following.
I haven’t get the exact conditions for reproduction yet, but In Studio 20.10.9 with System.Activities package 21.10.2 this occurs. If downgrade System.Activities package to 20.10.4 (this is bundled version of Studio 20.10.9) , there is no error.
So for now can you try to downgrade System.Activities package to 20.10.4, if you use Studio except the latest.
We can’t downgrade as we have been asked to use the latest version
Which version of Studio do you use, 21.10 , 20.10?
thank you very much for sharing. Very interesting aspect. It could be be possible that the “older” Studio release doesn’t contain the Roslyn compiler, that would explain everything.
Have you solved your case or not yet?
In case you haven’t I will suggest to use the expression mentioned is my post referred in here:
Create an invoke code with one argument in/out named InitialDT and as value give your table containing the values (83 columns)
InitialDT.AsEnumerable.Where(Function (c) c("<Name of the column>").Equals("")).Select(Function(c)
c("<Name of the column>")=“0”
Replace the “<Name of the column>” with your column name (the one you would like to replace the values)
Replace - Equals("") with Equals("-241")
if the column is of other type than string you can add the .ToString like this:
InitialDT.AsEnumerable.Where(Function (c) c("<Name of the column>").ToString.Equals("")).Select(Function(c)
c("<Name of the column>")=“0”
Copy the invoke 3 times and change the mane of the column.
Let me know if worked.
We cant use Invoke Code activity and hence we prefer taking an assign activity and writing a linq
In this case the only solution for you is to use a combination of Linq expresions.
First - Do you have a unique ID in your table that can be used for merge?
If the first is yes you can split the table in two.
One part to contain the columns you would like to replace the values in and the UniqueID
Second one with the rest of the columns and the UniqueID.
Use the Linq expression in my post to replace the values
Use a second Linq expression to merge back the columns.
You can do the split and merge with standard UiPath activities also so is your decision.
P.S. If you don’t have an UniqueID you can generate it.
Hope this helps.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.