Sum numerical attribute (Shipment)

Prev Next

See also: Sum numeric attribute, Sum numeric attribute (Order)

Event action – Abstract

Purpose: This function aggregates, for one or more Line item types in a shipment, the individual values for a selected Numeric types in a Source Level of the line item hierarchy to calculate subtotals for the line items of a parent Target level. The subtotals are assigned as a value (value) to the (aggregated) numeric attribute of the same number type in the Target level.

Tooltip

  • Usage: The event action must be executed with a shipment as the reference object. The calculation takes into account the selected Line item types and, within the associated line item hierarchy, sums the values of the aggregated numeric attributes for exactly one Numeric types (Type) in the specified Source level to assign subtotals to the line items of a parent target level. Rounding of the individual values to limited Decimal places can be defined.

  • Parameter:

    • The single selection for the Type (Numeric types) parameter defines which numeric attributes are aggregated.

    • The Target level specifies an absolute ( ≥0) or relative value to the lowest level (<0) at which level of the line item hierarchy subtotals are written.

    • The Source level determines an absolute (>0) or relative value to the lowest level (≤0) at which level of the line item hierarchy single values are summarized.

    • Decimal places defines if (0=no rounding) or how many (>0) single values should be rounded before aggregation.

    • The calculation is applied to the line item hierarchies of the Line item types defined by multiple selection.

  • Output: Updates for the values of numeric attributes for the Numeric types selected by Type in items of the Target level for all selected Line item types.

  • Note: The header level of the reference object can be addressed as the Target level with the value 0. However, aggregation at the header level works correctly only with a single selection for the Line item types parameter.

  • Warning: If the Source level below a Target level item does not contain any single values, the aggregated numeric attribute of this item is assigned the value 0.

images/download/attachments/177913059/image-2024-9-23_9-11-47-version-1-modificationdate-1727075506420-api-v2.png

The Sum numerical attribute (Shipment) event action creates subtotals for the numeric attribute values for exactly one Numeric types selected by Type within the item hierarchy of a reference object of the Shipments type.

For each line item of a selectable Target level (target item), a subtotal is determined that combines all single values from a selectable subordinate Source level. The summary of single values from the direct or indirect sub line items is assigned as a value to the aggregated numeric attribute for the same Numeric types at the Target level. A value existing at the target item will be overwritten. The subtotal is rounded or not depending on the setting for the Decimal places parameter.

images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/warning.svg CAUTION images/s/-95e2zf/9012/8yg2g7/_/images/icons/emoticons/warning.svg If the subhierarchy below a certain target item does not contain any values in the Source Level for the Numeric types to be summarized, then the value 0 is assigned for the target item.

Source level and Target level can be identified in either an absolute or relative way to the lowest hierarchy level (see 'Configuration'). Under certain circumstances, the header level of the reference object can also serve as the Target level.

â–ºNOTEâ—„ Regardless of whether absolute or relative references are used, the Target level must effectively always be above the Source level, otherwise no aggregation takes place.

The Line item types parameter defines by multiple selection a positive list for the line item types relevant for the aggregation. Without specifications for the Line item type, only line items of the 'Default' (DEFAULT) type are considered relevant.

The Sum numeric attribute event action processes only the volatile data of the reference object and does not save it.

Specific variants of this event action are provided for the entity types Common business object and Orders, which work according to the same principles.

â–ºNOTEâ—„ An illustrative runtime example can be found on the page for the entity type Common business object:

Configuration

The event action Sum numeric attribute expects a shipment (see Shipments) as the reference object. In the context of entities of other types, the event action has no effect without an error occurring at runtime.

As a required field, the Type statically determines by single selection the Numeric types of the attributes whose values are to be summed up.

The Target level parameter uses a positive or negative integer index to define the hierarchy level for which subtotals are to be calculated:

  • Value> 0: absolute level; number of levels below the header level.

  • Value< 0: relative level; number of levels above the 'lowest level' (per Line item type).

  • Value= 0: 'Header level' of the reference object (see note below).

The Source level parameter uses a positive or negative integer index to define the hierarchy level in which to search for single values for the Numeric types:

  • Value> 0: absolute level; number of levels below the header level

  • Value< 0: relative level; number of levels above the 'lowest level' (per Line item type).

  • Value= 0: 'lowest level' (per Line item type).

Decimal places defines if and how the total is rounded:

  • Value= 0: No rounding.

  • Value> 0: Number of decimal places for rounding the single values before summing up.

The relevant Line item types for the calculation can be qualified by multiple selection.

images/download/attachments/177913059/image-2024-9-23_9-12-48-version-1-modificationdate-1727075568171-api-v2.png

â–ºNOTEâ—„ In Lobster Data Platform / Orchestration, each Line item type creates an independent line item hierarchy, so that the subtotals always summarize only single values for the same Line item type. If several Line item types are selected as relevant, then the entire event handling calculation procedure is repeated sequentially for each relevant Line item type. Therefore, the following aspects have to be considered:

  • If the Source level and/or the Target level is defined relative to the 'lowest level' of the line item hierarchy, the 'lowest level' is determined individually for each Line item type. The aggregation then concerns individual levels per Line item type.

  • If the Target level refers relatively or absolutely to the header level of the reference object, then each processed Line item type on this level uses the same numeric attribute for the selected Numeric types as the target item. This will be overwritten again and again, and the result will show only the partial total for the last processed Line item type. This is usually not desirable. A total sum over different Line item types at header level cannot be calculated with the event action in this way.