Add to List
Add to List
Section titled “Add to List”Type: list-add · Package: Collections Activities v1.0.3 · Output: none
Adds an element to the end of a list. It is the activity to accumulate data: keep storing each result as you loop through something.
How it works
Section titled “How it works”Appends item to the end of list, modifying it directly: any variable pointing to it sees the change. The list must exist (create it first with Create List). Repeated elements and null are allowed.
If the list has a specific type (for example, the List<string> returned by split(...)), the element must be of that type; lists created with Create List or newList() accept any value.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
list | List | — | The list to add to. |
item | object | — | The element to add. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”This activity does not return a value; it modifies the list in place.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'list' must be a List, got …. | list is not a list (the message shows the type received, or null if the variable is empty). Create it first with Create List. |
The value "…" is not of type "…" and cannot be used in this generic collection. | The list has a specific type and the element is of another one (.NET message). Convert the element, for example with str(...). |
Example
Section titled “Example”Create List → output: pendingFor Each items = invoices itemVariable = invoice └─ activities: If condition = str(invoice["Status"]) == "Pending" └─ then: Add to List list = pending item = invoice["Number"]
Log message = "Pending invoices: " + join(pending, ", ")Related activities
Section titled “Related activities”- Create List — create the list.
- Get List Item — read an element.
- List Count — count elements.