Direct line items

Value resolver – Abstract

Purpose: Returns a list of line items for a given Line item type that are directly subordinate to the entity in the input value.

At header level:

Within the line item hierarchy:

images/download/attachments/78256004/image2022-7-26_12-48-19-version-1-modificationdate-1658832499718-api-v2.png



images/download/attachments/78256004/image2022-7-26_12-49-20-version-1-modificationdate-1658832561052-api-v2.png

The Direct line items value resolver returns a list of line items for a specific Line item type that are directly subordinate to the entity in the input value.

  • The value resolver not only allows access to existing items within the hierarchy, but is also useful for selectively adding new line items to the existing hierarchy in conjunction with the List item value resolver.

It is intended exclusively for the context of entities whose type definition supports a line item hierarchy. Within the business transaction objects, this affects Orders, Shipments and the Common business object type, but not Manifests, as these do not have a line item hierarchy, but contain only a single level of 'manifest line items' (with the Shipments assigned to the manifest).

The appearance of the value resolver differs depending on the level of the line item hierarchy at which it is used:

  • At the header level (see image above left) – if the input value specifies the parent entity of the line item hierarchy – the Of type parameter must be used to select the Line item type for which the line items of the top hierarchy level are returned.

  • Within the line item hierarchy – if the input value specifies a particular hierarchical line item within the hierarchy – the Line item type is already predetermined by the parent line item, so the parameter is omitted.

Configuration

When used at header level, the Line item type must be selected. For read accesses to existing line items, the selection acts as a filter. The selection is even more important if new line items are to be added via the List item value resolver. Because then the selection in the value resolver declares which line item type is added.

The selection field for the Of type parameter (to be read in conjunction with the name of the value resolver as Direct line items Of type) refers to the dynamic enumeration Line item type and supports a search function as shown on the right.

Dynamic enum filters for the Line item type that can be applied in the context of the configuration can restrict the selection options. Such restrictions have no influence on the runtime behaviour.

images/download/attachments/78256004/image2022-7-26_12-50-22-version-1-modificationdate-1658832622454-api-v2.png

Examples

Add an item of a specific line item category at the header level

When creating a new order, a service line item with default data should be created automatically.

Configuration:

The event handling shown on the right reacts to the Triggering event 'New' (see Common action event), i.e. it becomes active when the 'New' button is pressed in a data input form. The ideal time to initialize the data of the new entity automatically.


The Validating rule uses a Check type to ensure that the new entity is an order. The following actions are executed only if this is the case.


As an Action on passed rule an Execute with event action is executed. The new service line item is defined as the reference object for the action block below via its Object Resolver parameter:

  • The Direct line items value resolver defines the list of all direct service line items to which a new item is added by selecting 'Service' for the Of type parameter.

  • The concatenated List item value resolver adds the first service item by 'Add first' Mode.

In the action block, the new line item can be filled with default values as required. In the example, a Set value event action assigns a default value only to the 'Goods description' text attribute.

images/download/attachments/78256004/image2022-7-26_12-53-6-version-1-modificationdate-1658832786178-api-v2.png

Check for 'sub-items' with certain properties

A Client workflow determines in the context of an input form for Shipments whether sub-items exist for a line item displayed in the form which has set the indicator attribute 'Dangerous goods'. Depending on the result of the search, an active (red) or inactive (light gray) warning icon appears in the context of the line item.

Runtime example:

images/download/attachments/78256004/image2022-7-26_12-58-2-version-1-modificationdate-1658833082568-api-v2.png

  • The warning symbol for 'Dangerous goods' only appears in the line item if the indicator attribute 'Dangerous goods' is set for at least one (direct) sub-item of the line item.

  • The sub-items themselves are not displayed in the input form.

Configuration:

The client workflow shown on the right is executed in the input form for Shipments when loading the data for each item line. Via a link to the Element containers for the line item data the 'shipment line item' is provided as input value.

  • The Validating rule uses Check type to ensure that there is a 'Shipment line item' in the input value.

  • As an Action on passed rule, an If then else event action is executed, which has exactly one objective: If the shipment line item in the input value does not have a sub-item with the 'Dangerous goods' indicator, the client workflow is terminated by the Abort. Then the 'Actions on 'false'' are executed in the surrounding Behaviours (not in the image). Otherwise – i.e. if at least one 'Dangerous goods' sub-item is found, the client workflow ends without aborting and the 'Actions on 'true'' are executed. The check is implemented as follows:

    • The outer Entity property rule is fulfilled exactly when no 'Dangerous goods' sub-items are found, because then the criterion Is empty for the return value from the Rule list resolver applies.

    • The Direct line items value resolver returns all direct sub-items of the line item present as input value for the Rule list resolver.

    • The Rule list resolver searches for a sub-item that has an indicator attribute of the type 'Dangerous goods' with the value 'true'. The first match is returned, otherwise the return value is 'no value' ($null).

images/download/attachments/78256004/image2022-7-26_13-2-8-version-1-modificationdate-1658833328898-api-v2.png