- I’m assigning a string value to the variable
thisCSVin the Assign activity thisCSVis of type String- I get the error:
“Cannot assign from type ‘System.Object’ to type ‘System.String’ in Assign activity ‘Assign’”
thisCSV in the Assign activitythisCSV is of type String“Cannot assign from type ‘System.Object’ to type ‘System.String’ in Assign activity ‘Assign’”
Please open advanced editor and give the same value in set value field and check if the error persists
cheers
To explain this abit more. The assign activity has a dynamic datatype based on the variable you are assigning to, by default its object but will transform to string etc when you add a string variable. This works on both sides of the assign.
Sometimes, that event doesn’t fire properly and it gets stuck thinking the variable is an object etc.
In scenarios like this, you can usually fix it by removing either the variable and adding it back, or doing the same for set value, this should force it to re-evaluate the data type.
Try by keeping set value like - “C:\Users\xxxx\Downloads\”.ToString
Hi @x25115936
What I often do myself when experiencing this issue:
Regards
Soren
I encounter this quite often, mostly when I use assign, have some value stored on a clipboard, set it into the value property of the assign activity. Then, create a variable by setting the name property using ctrl-k for quick creation. If I then alter the datatype in the data manager this often happens.
The workaround is to just recreate the assign, set the values in a different sequence. Create variable, set the variable name in the assign, then the value never seems to fail.
For me a matter of unlearning some habits that don’t go well with the studio.
This usually happens when the variable on one side of the Assign is typed as a String, but the value you’re giving it is an Object. I’ve run into this a lot in UiPath. I’d check the variable types and either convert the Object with .ToString or change the target variable type if it should hold an Object instead.
Can you erase and add the variable again?