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

DynamicArray_List_logic.png
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).

DynamicArray_AddToCollection.png

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

DynamicArray_Decision.png

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

DynamicArray_DisplayData.png

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

 

Attachments: