<img src="//trc.taboola.com/1222697/log/3/unip?en=page_view" width="0" height="0" style="display:none">


The Knowledgebase articles are deprecated. Please visit the new Guides and Resources here: https://www.uipath.com/developers/guides-and-resources.

Knowledge Base

How to work with a dynamic array.

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)

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

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


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

5. 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).


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


Note: This workflow was created & tested with UiPath Studio 8.