--- title: "Calculate aggregate number of packages (Order)" slug: "ord-calculate-aggregate-number-of-packages-actor" updated: 2026-04-02T06:26:55Z published: 2026-04-02T06:26:55Z canonical: "docs.lobstersoftware.com/ord-calculate-aggregate-number-of-packages-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. # Calculate aggregate number of packages (Order) *See also:* [Calculate aggregate number of packages](/v1/docs/en/cmn-calculate-aggregate-number-of-packages-actor)*,* [Calculate aggregate number of packages (Shipment)](/v1/docs/en/shp-calculate-aggregate-number-of-packages-actor) > [!NOTE] > Event action – Abstract > > **Purpose:** Populates the fields for 'Aggregate number of packages' across line item levels of all or selected line item types in an order and optionally (additionally) summarizes the 'Number of packages' of the direct line items as on the header level. > > > [!TIP] > > Tooltip > > > > - **Usage:** The event action must be executed with an order as the *reference object*. The calculation optionally takes into account *selected* or *all* **Line item types**. Depending on the **Calculate summary** option, the 'Number of packages' in the header level is also updated. > > - **Parameter:** > > - The *optional* multiple selection for **Line item types** defines line item types for which the 'Aggregate number of packages' should be calculated. By default (without a selection), the 'Aggregate number of packages' is updated in line items of all types. > > - The **Calculate summary** option defines whether the sum over the 'Number of packages' of the direct line items of all relevant **Line item types** should be assigned to the 'Number of packages' field in the header of the order. > > - **Output:** > > - Updates the 'Aggregate number of packages' field of all relevant **Line item types**. > > - *Optional*: Updates the 'Number of packages' in the header level as a summary over the 'Number of packages' in direct line items of the relevant **Line item types**. ![images/download/attachments/177907327/image-2024-8-7_16-25-58-version-1-modificationdate-1723040758437-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-8-7_16-25-58-version-1-modificationdate-1723040758437-api-v2.png) The event action [Calculate aggregate number of packages (Order)](/v1/docs/en/ord-calculate-aggregate-number-of-packages-actor) executes the following steps for all or selected **Line** **item** **types** (see [Line item type](/v1/docs/en/base-line-item-type)) in a *reference object* of the 'Order' type (see [Orders](/v1/docs/en/ord-order)): 1. Within the line item hierarchy for each relevant [Line item type](/v1/docs/en/base-line-item-type), the field 'Number of packages' (`numberOfPackages`) is assigned the value 1 for each line item if it is empty or filled with 0. 2. Within the line item hierarchy for each relevant [Line item type](/v1/docs/en/base-line-item-type), the field 'AggregateNumberOfPackages' (`aggregateNumberOfPackages`) is filled for each line item according to the procedure described in the section 'Calculation logic'. 3. If the option **Calculate summary** is selected (default), then the total is additionally calculated via the field 'Number of packages' (`numberOfPackages`) in all direct line items for all relevant **Line item types**. 4. This total number is assigned to the field 'Number of packages' (`numberOfPackages`) of the *reference object*. **NOTE:** Details on the calculation logic and an informative runtime example can be found on the page for the [Common business object](/v1/docs/en/orchestration-common-bto) entity type: - [Calculate aggregate number of packages](/v1/docs/en/cmn-calculate-aggregate-number-of-packages-actor) ## Configuration ![images/download/attachments/177907327/image-2024-8-7_16-28-32-version-1-modificationdate-1723040912609-api-v2.png](https://cdn.document360.io/4be90b94-ec83-41d8-963e-962df16110d4/Images/Documentation/image-2024-8-7_16-28-32-version-1-modificationdate-1723040912609-api-v2.png) The event action [Calculate aggregate number of packages (Order)](/v1/docs/en/ord-calculate-aggregate-number-of-packages-actor) expects an order (see [Orders](/v1/docs/en/ord-order)) as the *reference* *object*. In the context of another object type, the event action has no effect without an error occurring at runtime. The **Calculate summary** option (set by default) controls whether the 'Number of packages' field in the *reference* *object* header data should be updated based on the information for [Direct line items](/v1/docs/en/base-get-line-items-resolver) of the relevant **Line item types**. Multiple selection for **Line item types** can be used to define a positive list for *relevant* **Line item types** (see [Line item type](/v1/docs/en/base-line-item-type)). - If no **Line item types** are selected, all line items in the *reference* *object* are evaluated regardless of the [Line item type](/v1/docs/en/base-line-item-type).