Can I predefine the default value of a variable using other variables uipath?

Hello - I was wondering if I could create a variable and inside the default value of that variable use another variable to define it.

VarX default value is 123
VarY default value is VarX.tostring + “XYZ”

Can the first activity in the workflow print VarY as “123XYZ”?

@Michael_Pansolini - Have you tried to print whatever you mentioned above, using writeLine/Messagebox\Log Message activity ?? if so, what is the output you got?

Yes, it can.

However, values assigned during runtime won’t reflect in the default value. Your scenario will work because you have set a default value for VarX.

VarX with default value 123
VarY with default value VarX.ToString + "XYZ"

Now value of VarY at run time will be 123XYZ

Let us say you change the value of VarX at runtime to 456 using an assign activity.

The default value in VarY will still be 123XYZ and not 456XYZ

Hi Michael,
You can use variable in setting of default value (variables panel).

Hmm - so in your second example, If I wanted the output of Y to change to 456XYZ, what would I have to do?

You will need to use an assign activity if you want to change the value of Y.
Edit: When you set a default value for a variable is like having an assign activity in the begging of your workflow. if for some reason you want to change the value, you need to use an assign activity (or an activity with output value).

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