--- title: "Sum packaging (Shipment)" slug: "shp-shipment-calculate-packaging-summary-actor" updated: 2026-04-02T08:25:35Z published: 2026-04-02T08:25:35Z canonical: "docs.lobstersoftware.com/shp-shipment-calculate-packaging-summary-actor" --- > ## 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. # Sum packaging (Shipment) *See also:* [Sum packaging (Order)](/v1/docs/en/ord-order-calculate-packaging-summary-actor), [Sum packaging (Manifest)](/v1/docs/en/mfst-manifest-calculate-packaging-summary-actor), [Type of packaging](/v1/docs/en/base-type-of-packaging) > [!NOTE] > Event action – Abstract > > **Purpose:** Totals the number of packages for one or all packaging types in a shipment from the line items of all levels and writes the total(s) to the packaging total attributes in the shipment header. > > > [!TIP] > > Tooltip > > > > - **Usage:** The event action must be executed with a shipment as the *reference object*. The calculation takes into account either a specific [Type of packaging](/v1/docs/en/base-type-of-packaging) (see **Type** parameter) or all packaging types that occur in the shipment. > > - **Parameter:** The *optional* **Type** parameter restricts the evaluation to *a specific* [Type of packaging](/v1/docs/en/base-type-of-packaging). By default (without a selection) the packaging sum attributes are updated for all packaging types found in the shipment. > > - **Output:** Updated or newly added packaging total attributes in the shipment header. > > - **WARNING:** If the calculation is performed across the board for all packaging types (without selection for **Type**), then existing values in packaging sum attributes for packaging types that do not (no longer) occur in the shipment are not automatically deleted. ![images/download/attachments/177913076/image-2024-9-23_9-35-55-version-1-modificationdate-1727076954707-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-9-23_9-35-55-version-1-modificationdate-1727076954707-api-v2.png) The event action [Sum packaging (Shipment)](/v1/docs/en/shp-shipment-calculate-packaging-summary-actor) totals the quantities for a specific [Type of packaging](/v1/docs/en/base-type-of-packaging) (or all) in the items of a shipment that exists as a *reference object*. The value in the 'Number of packages' field (`numberOfPackages`) and not the 'Aggregate number of packages' field (`aggregateNumberOfPackages`) is crucial for the imputation on the level of the respective line item. **CAUTION****:** If the 'Aggregated number of packages' is calculated for a [Line item type](/v1/docs/en/base-line-item-type), e.g. with the event action [Calculate aggregate number of packages (Shipment)](/v1/docs/en/shp-calculate-aggregate-number-of-packages-actor), in order to cascade the number of packages in sub-items in a multi-level line item hierarchy, this leads to inconsistencies in the calculation of packaging totals for each [Type of packaging](/v1/docs/en/base-type-of-packaging) that occurs in these sub-items. The total number per [Type of packaging](/v1/docs/en/base-type-of-packaging) over all shipment items is written to the corresponding packaging summary attribute in the shipment header (see [Input forms for shipments](/v1/docs/en/administration-designer-entity-form-shipment)). **NOTE:** There are corresponding event actions for [Orders](/v1/docs/en/ord-order) ([Sum packaging (Order)](/v1/docs/en/ord-order-calculate-packaging-summary-actor)) and [Manifests](/v1/docs/en/mfst-manifest) ([Sum packaging (Manifest)](/v1/docs/en/mfst-manifest-calculate-packaging-summary-actor)). In configurations, the 'matching' event action must always be used for the *reference object* in question. To avoid confusion, no error message occurs at runtime. In this case, the calculation does not return a result. ## Configuration ![images/download/attachments/177913076/image-2024-9-23_9-36-39-version-1-modificationdate-1727076998315-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-9-23_9-36-39-version-1-modificationdate-1727076998315-api-v2.png) The event action [Sum packaging (Shipment)](/v1/docs/en/shp-shipment-calculate-packaging-summary-actor) expects a shipment as a *reference object* (see [Shipments](/v1/docs/en/shp-shipment)). In the context of a different object type, the event action has no effect without an error occurring at runtime. The *optional* **Type** parameter can be used to limit the evaluation to *a specific* [Type of packaging](/v1/docs/en/base-type-of-packaging). - If no **Type** is specified, each [Type of packaging](/v1/docs/en/base-type-of-packaging) that appears in the line items of the shipment are added up. **IMPORTANT:** If no **Type** is specified, the action updates only the summary attributes of the packaging types that are currently in use. If in previous calculations summary values were calculated for types that currently no longer occur in any of the shipment items, then these values are retained unchanged. They must be explicitly reset or deleted if necessary. ## Example In an input form for [Shipments](/v1/docs/en/shp-shipment), it should be possible to update the *packaging summary attributes* for each [Type of packaging](/v1/docs/en/base-type-of-packaging) by clicking on a [Button](/v1/docs/en/fre-button-vo) (via a [Custom action event](/v1/docs/en/core-custom-action-events)). The same calculation should be triggered automatically when the shipment is saved. Configuration: | - 'Create' and 'Update' (see [Common action event](/v1/docs/en/core-common-action-event)) are selected as **Triggering** **events** so that the update of the summary attributes takes place each time 'Save' is performed. In addition, the calculation should be triggered on request via a [Custom action event](/v1/docs/en/core-custom-action-events) ('Calculate now'). --- - The **Validating rule** uses [Check type](/v1/docs/en/core-check-type-rule) to ensure that the **Actions on passed rule** are only executed in the context of a shipment. --- The **Actions on passed rule** are configured as shown on the right: - Before calculating the 'Packaging summary attribute', an event action of the [Modify list/Clear](/v1/docs/en/core-modify-collection-actor-clear) type deletes all existing attributes of this type, so that after the recalculation, no obsolete information for any 'packaging materials' that may no longer be relevant is contained in the shipment header (see 'Important' above). The list is determined by an [Attribute](/v1/docs/en/orchestration-rules-attributes) resolver. - Subsequently, the event action [Sum packaging (Shipment)](/v1/docs/en/shp-shipment-calculate-packaging-summary-actor) is executed with no restrictions for **Type**, so that a summary is calculated for each [Type of packaging](/v1/docs/en/base-type-of-packaging) that is in use within the items of the shipment. | ![images/download/attachments/177913076/image-2024-9-23_9-40-19-version-1-modificationdate-1727077219253-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-9-23_9-40-19-version-1-modificationdate-1727077219253-api-v2.png) | | --- | --- | Runtime example: The following example shows an input form for [Shipments](/v1/docs/en/shp-shipment) in which the 'Packaging summary attribute' per [Type of packaging](/v1/docs/en/base-type-of-packaging) (*configured here*: **Hobbock** and **Sack**) appear in the header level of the shipment. In the **Line** **items** section there are several items with sub-items, if necessary, for which a **Number of packages** in connection with the **Type of packaging** can be specified. **NOTE:** For the sub-items, in the example, the convention is that the **Number of packages** field indicates the absolute number of packages of the packaging type in question and not the number of packages within each package in the higher level. Specifically, for **Line item no.** 1.1, this means that exactly 1 (sack) 'Tobacco sample' is delivered together with the 5 hobbocks from the parent item, and not, for example, 1 bag with *each* hobbock. ![images/download/attachments/177913076/image2021-7-27_8-43-32-version-1-modificationdate-1727076101774-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-7-27_8-43-32-version-1-modificationdate-1727076101774-api-v2.png) In the image, the packaging totals have already been calculated by clicking the **Totalize** [Button](/v1/docs/en/fre-button-vo). After a change for the [Type of packaging](/v1/docs/en/base-type-of-packaging) of **Line item no.** 1.1 and 2 from 'Sack' to 'Bag' the shipment is saved. This results in the following image: ![images/download/attachments/177913076/image2021-7-27_8-44-6-version-1-modificationdate-1727076101770-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image2021-7-27_8-44-6-version-1-modificationdate-1727076101770-api-v2.png) **NOTE:** - Since no *packaging summary attribute* is configured for the 'Bag' [Type of packaging](/v1/docs/en/base-type-of-packaging) in the header, the summary value does not appear in the data input form. It is nevertheless saved in the data object of the shipment. - For the [Type of packaging](/v1/docs/en/base-type-of-packaging) 'Sack', no value appears since this [Type of packaging](/v1/docs/en/base-type-of-packaging) does not appear in any of the items anymore and because the event handling (see above) deletes all packaging summary attributes before calculation. - Without explicitly resetting (deleting) all packaging summary attributes in event handling, the value 26 would still appear in the **Sack** field.