--- title: "Sort list" slug: "core-sorted-list-resolver" updated: 2026-04-23T12:57:03Z published: 2026-04-23T12:57:03Z canonical: "docs.lobstersoftware.com/core-sorted-list-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. # Sort list > [!NOTE] > **Value resolver – Abstract** > > **Purpose:** This sorts the entries in a list provided as an *input value* in ascending or descending order. *Hierarchical sorting criteria* can optionally be defined, the *value configuration* of which is applied to all list entries. > > > [!TIP] > > Tooltip > > > > - **Usage**: The [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver sorts the entries of a list available as an *input value*, taking into account the configured parameters. The return value is always a new list instance that lists all entries from the *input value* according to the sort order. > > - **Parameter**: The following parameters can be optionally used for an unspecified number of *sorting criteria*, which are applied hierarchically with descending priority: > > - The optional Compare value parameter can be used to define how a compare value is determined for the given list entries, which is then used instead of the list entry for sorting. > > - The **Ascending** option is checked by default. It must be unchecked to sort in descending order. > > - **NOTE:** > > - If no input value is present, the return value is `$null`. > > - If the *input value* is not a list, the return value is a list containing the *input value* as the only entry. ![images/download/attachments/169634132/image-2025-3-5_16-49-25-version-1-modificationdate-1741189765545-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_16-49-25-version-1-modificationdate-1741189765545-api-v2.png)The [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver sorts the entries of a list present as *input valu*e, taking into account one or more hierarchical sort criteria with the following parameters: - The optional **Compare value** parameter defines a value resolver that is applied per list entry to determine the value that is decisive for sorting. - The **Ascending** option (checked by default) defines the direction of sorting. It can be unchecked if descending sorting is desired. The return value is always a new list instance that lists all entries from the *input value* according to the sort order. 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 the return value is a list with this value as the only entry. ## Configuration | The optional **Compare value** parameter can be used to define a value resolver that is applied to each entry in the *input value* to determine a *compare value* for sorting. - Without a value resolver (default), the complete list entry is used as the compare value. | ![images/download/attachments/169634132/image-2025-3-5_16-50-6-version-1-modificationdate-1741189806387-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_16-50-6-version-1-modificationdate-1741189806387-api-v2.png) | | --- | --- | | The **Ascending** option is checked by default, which causes sorting in ascending order according to the **Compare value**. If sorting in descending order is desired, the **Ascending** option must be unchecked. | | Initially, the configuration of the [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver provides for a single *sort criterion*. - By clicking on the (plus) ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(57).svg) icon, further sorting criteria can be added to create a hierarchy with descending priority. - By clicking on the ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/forbidden.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/forbidden(25).svg) icon ("rubbish bin"), existing sorting criteria can be removed from a hierarchy as long as at least one *sorting criterion* remains. The screenshot on the right shows a configuration with two *search criteria*: - The list is first sorted in descending order according to the value in the `created` field of the list entries. - For entries that match in this field, the lower-ranking, second *search criterion* applies, which refers to the `name` field of the list entries and sorts in **Ascending** order. | ![images/download/attachments/169634132/image-2025-3-5_16-35-18-version-1-modificationdate-1741188917815-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_16-35-18-version-1-modificationdate-1741188917815-api-v2.png) | | **NOTE:** If the configuration is carried out in a context that contains a tree view, these *sorting* *criteria* can be rearranged using *drag & drop* to adjust their priority in the hierarchy. - The screenshot on the right shows a section of the *tree view* in which the **sortItems** element, which represents the list of *sorting criteria*, is highlighted. - The two child elements labelled **SortedListItem** represent the *sorting criteria*, as can be seen from their expanded structure. The order of these elements in the **sortItems** node can be changed using *drag & drop*. | ![images/download/attachments/169634132/image-2025-3-5_16-50-47-version-1-modificationdate-1741189847615-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_16-50-47-version-1-modificationdate-1741189847615-api-v2.png) | ## Examples ### Simple use case: Sort simple values In the following example, a list of simple values (*in JSON notation*: [`1,8,6,null`]) is output in descending order. Runtime example: ![images/download/attachments/169634132/image-2025-3-6_10-18-8-version-1-modificationdate-1741252688329-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-18-8-version-1-modificationdate-1741252688329-api-v2.png) Configuration: | In the context of an [Execute with](/v1/docs/en/core-with-actor) event action, the list defined statically for demonstration purposes is first defined as the *reference object* for the following event actions, as shown on the right: - From the static text (see [Static values](/v1/docs/en/core-literal-value-resolver)) in JSON notation, a list object is created via the [JSON to object](/v1/docs/en/core-json-decode-resolver) value resolver.In the action block the [Show alert (Popup)](/v1/docs/en/core-popup-actor) event action is executed, which defines the sorted list as the text of the **Message**: - The [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver does not define a **Compare value**, so the list entries are sorted directly. - The **Ascending** option has been unchecked so that the entries are sorted in descending order. | ![images/download/attachments/169634132/image-2025-3-6_10-20-26-version-1-modificationdate-1741252826267-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-20-26-version-1-modificationdate-1741252826267-api-v2.png) | | --- | --- | Variant: Based on the previous example, the statically defined list entries are now output in a random order. Configuration: *(As an adjustment within the previous configuration)* | In the [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver, a **Compare value** is now defined via the [Random long value](/v1/docs/en/core-random-long-resolver) resolver. This value resolver randomly allocates a value from the value range for the `Long` data type, resulting in random sorting. **NOTE:** The **Ascending** option can be checked or unchecked. Since the sorting is random, this affects the order of the entries in the specific case. For once, however, this has no influence on the *random* sorting as a whole. Effectively, the order in the return value always appears *randomly*. | ![images/download/attachments/169634132/image-2025-3-6_10-20-52-version-1-modificationdate-1741252852460-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-20-52-version-1-modificationdate-1741252852460-api-v2.png) | | --- | --- | ### Typical use case: Sort a list of objects by a specific property | Within an event handling the (`stakeholders`) variable refers to a list of [Companies/Clients](/v1/docs/en/base-company-account) that are involved in a business object. When saving changes, the user will be informed about the *companies involved*. A separate notification appears for each *company involved*, reflecting selected address characteristics of the company according to a uniform scheme. Specifically, the companies are then listed in alphabetical order by the "Name" (`address.name1`) property through a series of notifications of the "Info" type. | Runtime example: ![images/download/attachments/169634132/image-2025-3-5_17-3-37-version-1-modificationdate-1741190617424-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-5_17-3-37-version-1-modificationdate-1741190617424-api-v2.png) | | --- | --- | Configuration: | The `stakeholders` variable is accessed here in the context of an [Execute with](/v1/docs/en/core-with-actor) event action. The image to the right shows only the event actions in the action block and (at the very top) the data type of the return value of the variable: `Firmenkonto[]`. For event actions, a list of the *companies* *involved* is therefore available as a *reference object*. - The [For each loop](/v1/docs/en/core-for-each-entity-actor) event action iterates across the *companies involved* in the *input value* in alphabetical order. The **Resolver for entities** [Sort list](/v1/docs/en/core-sorted-list-resolver) value resolver is therefore used as the value resolver for entries: - In the **Compare value**, the "Name" property in the company address (`address.name1`) is first accessed via [Object property](/v1/docs/en/core-property-resolver) value resolver, according to which sorting is performed. - The concatenated [Upper case](/v1/docs/en/core-to-upper-case-resolver) value resolver ensures that the "alphabetical order" is maintained without consideration of upper/lower case letters. Otherwise, company names in lowercase (see "fast-or-furious Ltd." in our example) would be displayed after all in uppercase letters. **NOTE:** Alternatively, a [Lower case](/v1/docs/en/core-to-lower-case-resolver) value resolver could be used here. It is exclusively a matter of equal treatment of A-Z compared to a-z. - Within the loop, a [Show alert (Popup)](/v1/docs/en/core-popup-actor) event action is executed for each company account, in which selected company account data is prepared: - The same property that has already been sorted is used as the **Title**. The upper/lower case letters are retained here as maintained in the address. - For the **Message** itself, two address characteristics (`city` and `countryCode`) from the company account are combined here in context via a [Template](/v1/docs/en/core-template-content-builder) value resolver with literal characters ("/"). **NOTE:** The same result could also be achieved by a simple [Concat strings](/v1/docs/en/core-concat-string-resolver). However, as the number of properties displayed increases, preparing the data using a [Template](/v1/docs/en/core-template-content-builder) value resolver may be clearer and easier to maintain. | ![images/download/attachments/169634132/image-2025-3-6_10-24-8-version-1-modificationdate-1741253048411-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-24-8-version-1-modificationdate-1741253048411-api-v2.png) | | --- | --- | ### Special use case: Multi-stage sorting The sorting of companies in the previous example is now adjusted in such a way that it is first sorted according to the country code (`countryCode`) and only then according to the company name. Runtime example: (for the same list of *companies involved* as above) ![images/download/attachments/169634132/image-2025-3-6_10-3-55-version-1-modificationdate-1741251835338-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-3-55-version-1-modificationdate-1741251835338-api-v2.png) Configuration: | To achieve multi-level sorting, only one additional sort criterion (per ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(57).svg) ) needs to be added for the "Country" (`countryCode`) field within the existing configuration. **NOTE:** As the screenshot on the right shows, this should be positioned at the top of the list. However, adding ![images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/add.svg](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/add(57).svg) always creates a follow-up criterion, so that a new "top criterion" can only be placed by subsequently moving it in the tree view (see "Configuration") or through more complex interactions. | ![images/download/attachments/169634132/image-2025-3-6_10-32-45-version-1-modificationdate-1741253565212-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-32-45-version-1-modificationdate-1741253565212-api-v2.png) | | --- | --- | | **IMPORTANT:** The [Object property](/v1/docs/en/core-property-resolver) value resolver for the "Country" (`countryCode`) returns a value from the dynamic enumeration for the [Country](/v1/docs/en/core-country), type, which is used here directly as a *sort criterion*. Based on the sorting for the top criterion "Country" in the specific example (`DE < IE < IT`), it could be assumed that the "Name" (`name`) of the enumeration value is the deciding factor for the sorting. However, this assumption is not actually correct! The sort order for enumeration values is regulated differently depending on the execution context (server/client): - In the server context, the "ordinal" (`Long` value) from the enumeration is sorted numerically. - In the client context, the "Name" (`String` value) from the enumeration is sorted alphanumerically. For the countries referenced in the example – "Germany" (`DE/82`), "Ireland" (`IE/106`) and "Italy" (`IT/109`) – the order is always the same by chance, regardless of whether you sort by "Name" or "Ordinal". Even the localization would result in the same sorting by chance. This would look different for a list with the countries "Germany" (`DE/28`), "Austria" (`AT/14`) and Switzerland (`CH/215`): - Sorted by "Ordinal": "Austria" (`AT/14`) < "Germany" (`DE/28`) < Switzerland (`CH/215`) - Sorted by "Name": "Austria" (`AT/14`) < Switzerland (`CH/215`) < "Germany" (`DE/28`) - Sorted by localization: "Germany" (`DE/28`) < "Austria" (`AT/14`) < Switzerland (`CH/215`) For a stable sorting with values from dynamic enumerations, it is therefore essential to explicitly decide how these values should be integrated. | | The screenshot on the right shows a variant of the above configuration, in which the "Name" (`name`) field of the [Country](/v1/docs/en/core-country) value is read from the "Country" (`address.countryCode`) address field of the company account for the first *sort criterion*. The concatenated [Upper case](/v1/docs/en/core-to-upper-case-resolver) resolver ensures that the sorting takes place without differentiating between upper and lower case in the "Name" field. The fact that all names in the enumeration are capitalized is also just a "fragile" convention. **NOTE:** In the configuration on the right, the data field path that leads directly to the name of the enumeration value has been selected in the [Object property](/v1/docs/en/core-property-resolver) resolver: - `address.countryCode.name` The same effect can be achieved by linking two or three [Object property](/v1/docs/en/core-property-resolver) resolvers. | ![images/download/attachments/169634132/image-2025-3-6_10-30-48-version-1-modificationdate-1741253448037-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-30-48-version-1-modificationdate-1741253448037-api-v2.png) | | The variant in the screenshot on the right looks very similar to the previous one, but does not directly address the "Name" (`name`) field of the [Country](/v1/docs/en/core-country) value from the "Country" (`address.countryCode`) address field. The concatenated [Upper case](/v1/docs/en/core-to-upper-case-resolver) resolver recognizes that the *input value* ([Country](/v1/docs/en/core-country) type) is not a `String` and instead passes on its *string image* in upper case as a sort criterion. - In the *server context*, the "Name" (`name`) is a *string image* and the sorting is the same as in the previous example. - In the *client context*, sorting is based on the localization for the [Country](/v1/docs/en/core-country) (for the [Current locale](/v1/docs/en/core-current-locale-resolver) and in capital letters), which can lead to different results. | ![images/download/attachments/169634132/image-2025-3-6_10-32-17-version-1-modificationdate-1741253536981-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-32-17-version-1-modificationdate-1741253536981-api-v2.png) | | The somewhat more complex configuration in the screenshot on the right aims to force a sorting according to the localization for the [Country](/v1/docs/en/core-country) referenced in the address for the [Current locale](/v1/docs/en/core-current-locale-resolver) in upper case (i.e. case-insensitive) both in the *server context* and in the *client context*: - The [Value from localization](/v1/docs/en/core-resource-resolver) resolver uses the relevant localization with the following parameters: - **Bundle:** The *bundle name* is set here statically via the [Class](/v1/docs/en/core-class-value-editor) resolver for which the [Country](/v1/docs/en/core-country) class is selected. - **Resource***:* The *resource name* for the value of a dynamic enumeration is always the "name" (`name`), which is read here using the [Object property](/v1/docs/en/core-property-resolver) resolver. - The **Default value** for a [Country](/v1/docs/en/core-country) that does not even have a localization in the default language "English" (`en`) should also be the "Name" (`name`). --- **CAUTION****:** Even this substantial configuration effort compared to the initial "naive" access to the `countryCode` field does not result with 100% certainty in identical sorting results being achieved between the *server context* and the *client context* using the [Sort list](/v1/docs/en/core-sorted-list-resolver). For countries in the DACH region (as an example), the value resolver chain shown sends their default localizations for the [Current locale](/v1/docs/en/core-current-locale-resolver) "German" (`de`) to the sorting. Specifically, these character strings: - `DEUTSCHLAND` - `ÖSTERREICH` - `SCHWEIZ` However, the server and client sort the umlaut "Ö" differently (ASCII code/"OE"), so that Austria is categorized after Switzerland in the *server context* and between Germany and Switzerland in the *client context*. | ![images/download/attachments/169634132/image-2025-3-6_10-35-14-version-1-modificationdate-1741253713756-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2025-3-6_10-35-14-version-1-modificationdate-1741253713756-api-v2.png) |