Plural attributes (Resolver)

Resolver – Abstract

Purpose: In the context of a reference object (entity type must be attribute owner), a single value for a specific 'Plural attribute' is returned as a list.

images/download/attachments/78255872/image2021-9-23_17-0-15-version-1-modificationdate-1632409217692-api-v2.png

The Plural attributes (Resolver) provides access to a Plural attribute of an entity. As a reference object, it expects an entity that is considered an 'Attribute owner' according to its type (see Attribute (Resolvers)) and whose data model provides for at least one Plural attribute. The return value is a list of individual values, which can also be empty. For specific write and read accesses (see 'Examples'), the Resolvers specific to lists (e.g. List item, Rule list resolver) and Event actions (e.g. For each loop, Modify list) can be used.

The Plural attribute parameter specifies the type of 'Plural attributes' whose values are returned as a list. For each single value, the specific data model of the selected attribute type applies. An important common feature is the index field, which specifies a Long value for the sequential line item of the single value within the list. The Plural attributes (Resolver) returns the single values always arranged in ascending order by the index field. The integer index values are automatically assigned by the system (ascending from 0) when the list is accessed, e.g. via a form or the List item value resolver.

NOTE◄ Accessing the same attribute type via an Attribute value resolver returns the same individual values in principle, but does not sort them by the index field. Instead, the Attribute value resolver returns the individual values in chronologically ascending order, i.e. in the order in which they were added to the list. The chronological order is also reflected in the XML format of the reference object.

In the context of the entities predefined in the various Lobster Data Platform / Orchestration modules, 'Plural attributes' are rarely encountered. Depending on the installed/licensed modules, the following types of plural attributes are relevant:

Plural attributes type

Owner

Barcode attribute

Line items of business transaction objects (Common business object, Orders, Shipments).

Dangerous goods attribute

Products (e.g. within the line item level of business transaction objects).

Communication info

Addresses (e.g. within attributes of business transaction objects but also for Company accounts und Users).

Loading aid definition

Shipments

NOTE◄ The 'Plural attributes' are distinguished from 'Typed plural attributes', for which a separate value resolver is provided (see Plural attributes and Plural typed attribute resolver).

Configuration

The Plural attributes (Resolver) expects a reference object whose data model can contain at least one 'Plural attribute'.

The Plural attribute parameter provides a static single selection for the attribute type whose value list is accessed.

As long as the context of the configuration does not refer to a specific entity type, all plural attribute types that the system supports appear for selection.

The Combobox element offers a search function that takes into account the internal class names of the attributes as well as associated localizations from the language management.

images/download/attachments/78255872/image2021-9-23_17-1-16-version-1-modificationdate-1632409278531-api-v2.png

If, on the other hand, the context of the configuration refers to a specific entity type for the reference object, then only the plural attribute types that are explicitly implemented in the relevant data model appear for selection.

On the right, a Check type (not shown in the image) refers to an 'Address' (see Addresses), so the only option offered is the plural attribute type 'Communication info'.

images/download/attachments/78255872/image2021-9-23_17-2-5-version-1-modificationdate-1632409327584-api-v2.png

If no Plural attribute type is selected, then the return value of the value resolver is always 'no value' (null).

If a selected Plural type is not supported by the type of the reference object present at runtime, the return value is also 'no value' (null).

If the reference object present at runtime supports the selected Plural attribute type, but the reference object does not contain any relevant data, an empty list is returned.

Examples

Example of 'write access'

A new 'Loading aid definition' is added to an existing 'Shipment' (see Shipments) in the course of an event handling.

In the context of the given 'Shipment', the event actions shown on the right are configured within an event handling:

  • The Execute with event action is used here because the newly added instance for the plural attribute 'Loading aid definition' is assigned detailed data in several steps. For this purpose, this new instance is temporarily defined as an alternative reference object instead of the whole shipment:

    • First, the Plural attributes (Resolver) is used to access the Plural attribute 'Loading aid definition' of the shipment.

    • A new instance is added to the returned (possibly empty) list of individual values via the concatenated List item value resolver with the 'Add last' Mode. This new loading aid definition applies in the action block below as an alternative reference object.

  • Still within the Run as event action, a series of Set value event actions are configured to ensure all necessary assignments for fields of the newly created loading aid definition instance. In the example, data is provided for the type, id, and barcode fields.

    NOTE◄ For each plural attribute type, there can be individual validation criteria that are checked when the reference object is saved and, if necessary, rejected by an error message. The validation can concern single fields or the uniqueness of field value combinations within all single values of the attribute.

images/download/attachments/78255872/image2021-9-23_17-3-10-version-1-modificationdate-1632409392802-api-v2.png

Example of 'read access'

A Custom action event that is passed an 'Address' (see Addresses) as a reference object sends a specific message by e-mail to the first e-mail address found in the communication information stored in the address.

Configuration:

In an event handling for the relevant custom action event, the 'Validating rule' is configured as shown on the right:

  • First, a Check type ensures that an 'Address' is present as a reference object. The Check type also defines the context for the configuration of the subsequent rule(s), which allows targeted access to the plural attribute type 'Communication info' here.

  • The decisive e-mail recipient is determined within an Entity property rule.

    • The value resolver Plural attributes (Resolver) accesses the Plural attribute 'Communication info' and returns a list of all communication information contained in the address.

    • The concatenated Rule list resolver should determine from this list the first entry (with the option Resolve all as list deselected) that qualifies as an e-mail address, if any exists at all. The simplified criterion here consists of an AND junction between two instances of the Entity property rule. The first one requires the Communication type 'E-Mail', the second one checks if there is a string in the 'Value' field (communicationValue) containing the symbol '@'.

    • The value resolvers that follow in the concatenation refer to the 'match' that is expected as a return value from the Rule list resolver in the event of success. The Object property value resolver determines the 'Value' of the communication information (i.e. the text value classified as a relevant e-mail address). This is then passed to a variable ( mailTo) via the Store value as variable value resolver, so that the address found does not have to be 'resolved' again for the E-Mail event action in the action part of the event handling.

NOTES◄ The E-Mail takes place only if an e-mail address was determined, since the outer Entity property rule checks whether a 'Value' was determined (Not rule, Is empty).

If necessary, a more complex checking logic should be used in practice instead of checking for the '@' symbol.


images/download/attachments/78255872/image2021-9-23_17-4-39-version-1-modificationdate-1632409481692-api-v2.png images/download/attachments/78255872/image2021-9-23_17-6-38-version-1-modificationdate-1632409600337-api-v2.png