--- title: "Collect values" slug: "core-collect-resolver" updated: 2026-04-27T06:26:49Z published: 2026-04-27T06:26:49Z canonical: "docs.lobstersoftware.com/core-collect-resolver" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.lobstersoftware.com/llms.txt > Use this file to discover all available pages before exploring further. # Collect values > [!NOTE] > **Value resolver – Abstract** > > **Purpose:** Processes all entries (except `$null` values) of a list passed as *input value* with the optionally configurable value resolvers and lists the *resulting values* (except `$null` values) in the return value. > > > [!TIP] > > Tooltip > > > > - **Usage**: The entries obtained from the *input value* (either a list or a scalar value interpreted as a 'single list entry') are processed, taking into account the parameters (see below), to return a list of 'collected' result values. The value resolver thus defines a line-by-line *projection* ('mapping rule') for lists in the following sense. > > - **Parameter**: > > - The **Join collections** option (unchecked by default) means that the contained entries are processed as *result value*s instead of a result value, which is a list. > > - The **Unique values** option (unchecked by default) suppresses duplicates among the *result values*. > > - The optional **Value to collect** parameter allows value resolvers to be configured, which are applied to all entries from the *input value* to determine result values. Without a configuration, the entries from the *input value* are processed directly. > > - **NOTE:** Depending on the parameters and the occurrence of `$null` values, the list in the return value may differ from the list of processed entries with respect to the number and order of entries. ![images/download/attachments/78256106/image2022-9-28_10-16-31-version-1-modificationdate-1664352991111-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2022-9-28_10-16-31-version-1-modificationdate-1664352991111-api-v2.png) The [Collect values](/v1/docs/en/core-collect-resolver) resolver processes all entries (except `$null` values) of a list passed as *input value* with the value resolvers configured in the **Value to collect** parameter and lists the *result values* obtained in this way (except `$null` values) in the return value. - The **Join collections** option has the effect that the contained entries are processed as r*esult values* instead of a *result value* for the **Value to collect**, which is a list. - The 'list' for the *result values* is created as a *set* with the option **Unique values**, so each *result value* can be contained only once in the returned list. Special cases: - If the *input value* is 'No value' (`$null`), the return value is also 'No value' (`$null`). - If the *input value* is an empty list (`[]`), the return value is also an empty list (`[]`). - If the *input value* is a value that is not 'No value' (`$null`) but also not a list, then this value is processed as if it were the only entry in a list. - If **Value to collect** returns a list containing `$null` values as the *result value* (for an entry from the *input* *value*), entries with the value `$null` will exceptionally appear in the return value if the **Join collections** option is set. **NOTE:** Without the **Join collections** option, *result values* that are lists will always appear (including any `$null` values they may contain) as entries with type 'list' in the return value. ## Configuration | Parameter | Effect | | --- | --- | | **Join collections** | - Option unchecked (default): *Result values* of the 'List' type are taken into account directly, i.e. as an entry of the 'List' type, in the return value - Option checked: For *result values* of the 'List' type, the contained entries are 'resolved', i.e. considered as 'independent' entries in the return value. Example: The *input value* is a list of static values (*here*: Geo-coordinates with decimal numbers for 'longitude' and 'latitude' as angular measurements) corresponding to the following JSON notation: `[55.05,8.41],[47.27,10.18]`]A configuration for the **Value to collect** parameter is omitted, so that the entries are 'collected' directly (see below). - As a rule, the pair of coordinates should also be kept together in pairs in the *result*. The [Collect values](/v1/docs/en/core-collect-resolver) resolver does this if the option **Join collections** is unchecked (default). - If the option **Join collections** is checked, then the return value in the specific case gives the longitude and latitude alternately in a common list level: : `[55.05,8.41,47.27,10.18]` **NOTE:** The **Join collections** option only affects lists that are direct *result values*. If a list returned as a *result value* in turn contains entries that are lists, their 'grouping' as a list is retained. Entries from multi-level nested lists can be 'unified' if necessary by combining multiple instances of the [Collect values](/v1/docs/en/core-collect-resolver) value resolver. | | **Unique values** | - Option unchecked (default): the return value lists all *result values* (except `$null` values) in the order of the processed entries from the *input value.* - Option checked: The *result values* for the return value are 'collected' internally as a *set*, which by definition contains only 'unique values'. If the same *result value* occurs repeatedly, the duplicates are effectively 'suppressed'. **IMPORTANT:** The order of the *result values* in the return value does not reflect the processing order of the entries from the *input value.* Example: The input value is a list of static integers corresponding to the following JSON notation: `[32,16,8,-4,16,8]` . There is no configuration for the **Value to collect** parameter, so the entries are 'collected' directly (see below). - If the option **Unique values** is checked and no **Value to collect** is configured, then the return value in JSON notation is: [`32,16,-4,8`]. | | **Value to collect** | Defines an optional value resolver or a concatenation of value resolvers that is applied to each entry of a list in the *input value* (or the complete *input value* if it is not a list). - If the total *input value* is 'no value' `$null` (see 'Special cases' above) or an 'empty list' (without entries), then value resolvers in the **Value to collect** parameter are not processed. - If the list in the *input value* contains 'no value' `$null` as an entry, then no entry is added to the list in the return value and value resolvers in the **Value to collect** parameter are not processed. - If no value resolver is configured for the **Value to collect** parameter, entries from the *input value* (except `$null` values) are processed directly as result values. - If value resolvers configured for the **Value to collect** parameter return `$null` as the *result value* for an entry from the 'no value' input value, then no entry is added to the list in the return value. | ## Examples ### Simple use case: Determine unique values for an object property A list of loading aids types (see [Loading aids](/v1/docs/en/base-loading-aid)) should be 'collected', which refers to at least one direct default line item of a shipment (see [Shipments](/v1/docs/en/shp-shipment)). Configuration: | In the context of an event handling that receives the shipment to be examined as *input value* at runtime – e.g. within a [For each loop](/v1/docs/en/core-for-each-entity-actor) or [Execute with](/v1/docs/en/core-with-actor) event action – the following value resolver chain is configured: - The [Direct line items](/v1/docs/en/base-get-line-items-resolver) value resolver returns a list of all direct line items in the shipment with the 'default' [Line item type](/v1/docs/en/base-line-item-type) as the *input* *value* for the [Collect values](/v1/docs/en/core-collect-resolver) value resolver chain. - In the **Value to collect** parameter, the 'Loading aid.Type' (`loadingAid.type`) is determined for each line item by the [Object property](/v1/docs/en/core-property-resolver) value resolver. - The **Unique values** option was checked so that in the return value each used loading aid type is included only once. | ![images/download/attachments/78256106/image2018-12-11_16-8-13-version-1-modificationdate-1628600090088-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2018-12-11_16-8-13-version-1-modificationdate-1628600090088-api-v2.png) | | --- | --- | **NOTE:** Based on the number of entries in the return value (via the `length` field), these settings can be used to evaluate, for example, how many different loading aid types are contained in the direct default line items. A rule that checks whether this number is >1 can thus also easily determine whether *different* loading aid types are used within the shipment or not. ### More complex use case: Collecting values from selected instances for a multiple attribute on line item level The following example uses two instances of the [Collect values](/v1/docs/en/core-collect-resolver) value resolver in a nested arrangement, for a more complex evaluation in the context of a shipment (see [Shipments](/v1/docs/en/shp-shipment)). Specifically, a list of all unique 'barcode' values from barcode attributes found in direct line items of the 'Default' type in conjunction with a specification for the 'barcode reference' (`barcodeReference`) field of the attribute is to be determined. Configuration: Within a [Set value](/v1/docs/en/core-set-value-actor) event action the list of 'collected' barcodes is assigned to a variable (`BARCODES_MIT_REFERENZ`). ![images/download/attachments/78256106/image2018-12-11_16-25-0-version-1-modificationdate-1628600090082-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2018-12-11_16-25-0-version-1-modificationdate-1628600090082-api-v2.png) On the right side of the assignment, the searched 'barcode' values are 'collected' via the following value resolver chain: - As in the previous example, the [Direct line items](/v1/docs/en/base-get-line-items-resolver) value resolver returns a list of direct line items with the 'Default' item category as the *input value* for the *outer* [Collect values](/v1/docs/en/core-collect-resolver) resolver chain. This evaluates the value resolver chain defined in the **Value to collect** parameter on a per-item basis: - The [Plural attributes (Resolver)](/v1/docs/en/core-plural-attribute-resolver) value resolver returns a list of all instances for the plural 'barcode attribute' of the evaluated line item. - The [Rule list resolver](/v1/docs/en/core-list-rule-resolver) chain filters this list, to all instances of the attribute (see the **Resolve all values as list** option) whose field 'Barcode reference' (`barcodeReference`) is filled ('non-empty'). - The *inner* [Collect values](/v1/docs/en/core-collect-resolver) resolver chain collects from the list of 'referenced' instances for the 'barcode attribute' for the values from the 'barcode' (`barcode`) field. - Therefore, the list of relevant barcodes for the evaluated line item is determined as the **Value to collect** in the *outer* [Collect values](/v1/docs/en/core-collect-resolver) resolver. - The barcodes collected per line item in this list are processed individually as *result values* by the *outer* [Collect values](/v1/docs/en/core-collect-resolver) resolver because the **Join collections** option is checked. - Since the **Unique values** option is also checked, any duplicates will be ignored. The return value contains each 'barcode' value exactly once.