Initializing multiple variables upon each new loop

Hi guys I had a question on how this is best done. Lets say I have 8-20 variables that are used throughout a bot process to either hold or extract data and each time the bot goes through a loop I need those variables initialized to their original state.

Is there a better way to do this other than using assign functions to set each variable back to “”? Or does Uipath initialize them automatically upon each loop? Thanks.

1 Like

Hey @css

The bot does not automatically assign it to the original state… but you can use different approaches like this…

  1. Use multiple assign activity to assign all the variables to its original value in one assign activity.
  2. If the variables are used only inside the loop, Set the scope of the variable to the body of the loop activity. In this, that sequence will execute multiple times and each time new item is processed the variables will get initialized to its default value.

“1. Use multiple assign activity to assign all the variables to its original value in one assign activity.”

Are you saying this can be done in a single Assign activity, or that you will have to make multiple; one for each variable?

1 Like

There is a multiple assign activity which allows you to assign multiple variables in one go. However if you are using a older version this might not be there… in that case you will need to use the assign activity which you are already familiar with

@css

As @Lahiru.Fernando said, older versions doesn’t have the multi assign activity. So in this case there is no option left except single assign activity

Thanks

1 Like

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