Collections Activities
Version: 1.0.0 · 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 |
|---|---|---|
| Contar elementos | List Count | = count(list) o = list.Count |
| Element by index | Get List Item | = list[0] |
| Does it contain? | List Contains | = list.Contains(valor) |
| Value of a key | Get Dictionary Value | = dictGet(d, "clave") or = d["clave"] |
| Add to list | Add to List | = listAdd(list, valor) |
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.
The outputVariable pattern
Section titled “The outputVariable pattern”Activities that return a result (count, get, check) save it in the variable that you indicate in the outputVariable field.
Activities
Section titled “Activities”Listas
Section titled “Listas”| Activity | Type | Output | What it does |
|---|---|---|---|
| Create List | list-create | List | Create an empty list |
| 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 | boolean | Does it contain an element? |
| Remove from List | list-remove-at | — | Delete by index |
| Clear List | list-clear | — | Empty the list |
Diccionarios
Section titled “Diccionarios”| Activity | Type | Output | What it does |
|---|---|---|---|
| Create Dictionary | dict-create | Dictionary | Create an empty dictionary |
| 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 | boolean | 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 — its properties and methods.
- Expressions › Collections — the alternative in a single line.