Generic Value: Cannot add System.Int32 to System.String

I have 2 GenericValue variables with int and str values, If the first element in the expression is GenericValue variable it is filled as
integer, UiPath Studio will do the sum of the elements.
If the first element in the expression is the GenericValue variable to be populated as a string, UiPath Studio will perform the compounding of the elements.

The question is, for example when I filled the value of GenericValue string character “a” and GenericValue integer digit (12) and I want assign the result expression integer (12) + string “a”… Why I gettin some error? can you guys answer the spesific?
Thanks!

@Anggara_Rahmadhani
UiPath Studio has an automatic conversion mechanism of GenericValue variables, Taking this into consideration,
If your first expression is String – It will concatenate.
If your first expression is Int – it will sum up.

In your case the first expression is Int so it wouldn’t be able to sum, Instead it throws – Assign: Cannot add System.Int32 to System.String

Initialize Int variable as, Int – GenericValue – “12”
OR
Reverse the expression like Assign = str + Int → It will work

Also refer this for clear understanding of GenericVariables — GenericValue Variables

Hi @Karuna
Thanks for the insight

Cheers!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.