Collections Activities
Version: 1.0.3 · ID: zoan-packages-collections · Author: Zoan Software
The Collections package creates and manipulates the two most commonly used collection types: lists (sequences of elements) and dictionaries (key→value pairs). It is used to accumulate results, keep records, group related data or configure options.
Activity or expression: the two forms
Section titled “Activity or expression: the two forms”Almost everything these activities do also has a direct equivalent in an expression. For example:
| Goal | Activity | Equivalent expression |
|---|---|---|
| Count elements | List Count | count(list) or list.Count |
| Element by index | Get List Item | list[0] |
| Does it contain? | List Contains | list.Contains(value) |
| Value of a key | Get Dictionary Value | d["key"] (or dictGet(d, "key"), which gives null instead of failing when the key does not exist) |
| Add to list | Add to List | listAdd(list, value) |
Which one to use? The activities make the flow more explicit and visual (useful for those just starting out). The expressions are shorter and more comfortable when you are already inside another formula. Both are correct — choose according to whether you prefer clarity or concision. See Expressions › Collections.
Where the result goes
Section titled “Where the result goes”Activities that return a result (create, count, get, check) deliver it through the activity’s output field, like every other activity: you pick there the variable that receives it (→ output: variable in the examples). Activities that modify a collection (add, set, remove, clear) change it in place and return nothing: any variable pointing to that list or dictionary sees the change.
Activities
Section titled “Activities”| Activity | Type | Output | What it does |
|---|---|---|---|
| Create List | list-create | List | Create a list, empty or with initial items |
| Add to List | list-add | — | Add an item |
| Get List Item | list-get | object | Element by index |
| List Count | list-count | int | Number of elements |
| List Contains | list-contains | bool | Does it contain an element? |
| Remove from List | list-remove-at | — | Delete by index |
| Clear List | list-clear | — | Empty the list |
Dictionaries
Section titled “Dictionaries”| Activity | Type | Output | What it does |
|---|---|---|---|
| Create Dictionary | dict-create | Dictionary | Create a dictionary, empty or with initial pairs |
| Set Dictionary Value | dict-set | — | Assign/update a key |
| Get Dictionary Value | dict-get | object | Value of a key |
| Dictionary Contains Key | dict-contains-key | bool | Does the key exist? |
| Dictionary Count | dict-count | int | Number of pairs |
| Get Dictionary Keys | dict-keys | List | All the keys |
| Remove Dictionary Key | dict-remove | — | Delete a key |
Next steps
Section titled “Next steps”- Create List / Create Dictionary — create a collection.
- Data Types › Collections — their properties and methods.
- Expressions › Collections — the alternative in a single line.