How to create an Array Dynamic in UiPath?

How to store values in Array dynamically?

  • First of all, you will have to define an empty array in UiPath.

  • Read your Excel file to get tha data and store value in the data-table variable dt_Values.

  • Read the data one by one using For each row in the data table

  • Using the Assign activity, Use Append Method.

  • Run the BOT and your excel data will be stored in the array dynamically.

Enjoy Automation

Ankit Chauhan

1 Like

You could also use the Add to Collection activity.

And this post should be in Tutorials, not Help.

Thanks for the feedback but instead of the Collection, Array is easy to use and understand.

1 Like

An Array IS a collection.

1 Like

If you want to work with a collection that doesn’t have a fixed number of elements, you can use a list instead of an array.

A List expands as you add new items to it. You can add new items to a list using the Add To Collection activity (you will find it under Programming->Collection category).

The attached ListExample workflow shows you how to declare, init, add and display items from a list.

Workflow Steps

  1. Initializing the list:

items=new List(of string)

  1. Get the input for the list, using an InputDialog activity.

  2. The new element (name) is added to the items collection (with Add To Collection activity).

  3. The robot asks if you want to continue adding new elements (using Message Box activity). The response is saved in the answer variable.

  4. A decision is taken (using a Flow Decision activity): if the answer to the previous step was Yes, the workflow will return to step 2. A No answer will move the workflow to the next sequence (step 6).

  5. The sequence will go through each item in the list. It will pop up a window with the inputName of each element.

This may help you,
Rachel Gomez