List Contains
List Contains
Section titled “List Contains”Type: list-contains · Package: Collections Activities v1.0.3 · Output: bool
Checks whether a list contains an element and returns true/false. Useful to avoid duplicates or validate membership.
How it works
Section titled “How it works”Looks for item in list, comparing each element by exact equality, type included:
- Text is case-sensitive (
"ana"is not"Ana"). - A number is not equal to its text (
5is not"5"), and numbers of different types don’t match either (integer5is not decimal5.0). If the list comes from another source, convert the value you look for to the same type first, for example withstr(...).
It does not modify the list.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
list | List | — | The list. |
item | object | — | The element to look for. |
Optional parameters
Section titled “Optional parameters”None.
Output
Section titled “Output”Returns a bool: true if any element equals item, false otherwise (also for an empty list).
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). |
Example
Section titled “Example”Avoid adding a repeated element:
List Contains list = processed item = id → output: alreadyThereIf condition = !alreadyThere └─ then: Add to List list = processed item = idRelated activities
Section titled “Related activities”- Add to List — add the element if it is not there.
- List Count — count elements.