Collections are data structures designed to hold multiple items. For example, you can store a list of employees in a collection, each with their name, position, and salary.
On the BRYTER platform, you can create collections by
- Reading multiple entries from a database,
- Allowing multiple responses from end users,
- Reading a set of data from an integration, or
- Creating multiple values in a value node.
Once your data is stored in a collection, you can
- Perform operations, such as calculating the sum of the collection’s entries or filtering the collection,
- Present collection items in an auto-generated document,
- Insert the collection into a table in a document,
- Run a module on each item in the collection (e.g., for sending emails or generating documents),
- Present the items in a collection as answer options or default selected values in a Single Select or Multiple Select node,
- Reference the collection (see below),
- Use the collection in the Rule Builder for transitions or conditional blocks (see below).
Structure of a collection
A collection can include up to 500 items. In the context of an employee list, each employee represents one item or record. Collections can have one or many fields, and each item can contain entries for each field. In our example, fields like Name, Position, and Salary are defined.
Reference a collection
Referencing collections operates a bit differently since there are typically multiple values to display. Therefore, you reference the entire collection, which is presented within a Collection Block. This block repeats for each item in the collection. Within the block, you can insert text and reference other variables.
To add grammatical syntax to a list of text from a collection, for example, Jane Doe, John Doe, and Susan Smith, use a Perform Collection Operation action.
Collections in conditions
You can also leverage collections to build conditions in transitions or conditional blocks. Since these conditions pertain to a list of items rather than a single variable, the configuration is as follows:
- When selecting the variable, you must choose the collection field. You cannot select a single individual collection item; your condition must refer to all items within the field.
- Choose a scope operator: All, Any, or No. Your condition will evaluate as true if the subsequent statement is true for all items, any item, or no item in the collection, respectively.
- The statement is built similarly to statements for single variables: You select an operator (the list of operators depends on your variable type) and input a value.
Here is an example of building a condition based on values in a collection: In this scenario, the condition is satisfied if at least one employee in the Employees collection has a salary greater than $1,000,000.
Known limitations
- A collection can contain a maximum of 500 items.
- Collections cannot be directly written into a database, but you can use a Batch Process action for this purpose.
- When referencing a collection, items are displayed in the order of updated_at and then by id. You cannot specify the display order.
- Formatting applied within a collection block cannot be rendered in a database. If a collection block is inserted into a single database text field, it will appear as an unformatted string containing the entire block.