Concatenating variables with strings not working

Hello people, I have an issue while concatenating variables into a string, it used to work before but I don’t know what went wrong.
I’ll show you what I’m trying to achieve:

I have three variables
variable1: "this is a “+ variable2 +” of colour " + variable3
variable2: “house”
variable3: “red”

But when I run the project I get this:
image

Not working.

What could possibly be wrong?

Hi @andres.enriquez

Instead of assigning the values this way, use 3 assign activities for each of the variable, then use message box to print the value.

Firstly , use assign activity for variable 2, then variable 3 and lastly for variable 1(as use are using variable 2 and variable 3 values in variable 1)

Thanks,

During the run time values will not get passed to it unless you call the variables just try by calling them separately it will get it out
Other wise try this "this is a “+ variable2 +” of colour " + variable3 in a message box

Hi Nitya! Thanks for the quick response.
I tried as you suggested:
image
But same result
image

I tried "this is a “+ variable2 +” of colour " + variable3 in a message box, but it’s not what I need. Actually my objective is to use variables values taken from a excel sheet and use them in another variable.

Ok then why you are giving it by default values in the variable pannel just pass your variable to it or share a image i can help much better thanks


hope it helps
Thanks and Regards
Happy automation

That worked! So we are forced to use the assign activity in order to concatenate variables to strings?

yes and its fine you finally got it
thanks and regards

You can’t do this in the defaults. variable1 and variable2 don’t have values yet when variable1’s default is processed. Take out the defaults, and do it with Assign activities in the correct order.

1 Like

You can concatenate strings in the variable defaults, but not the way you did it here. You’re referencing other variables’ defaults before the default has been processed.

1 Like

@andres.enriquez

Just to be clear…you need not assign all in assignactivities

You can assign only variable1 in assign activities and give default values to variable 2 and 3…

That way you will get the display as expected

If you give variable1 also in default the problem
Is all the variables are initialized together and default values are not present so…var2 and 3 are empty…if you use assign for var1 then var2 and 3 as already have default values.they would be populated

Cheers

Thanks a lot @Anil_G for the explanation!
Cheers!

1 Like

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