Counting Line Items
In this example, you want an incremental count of the number of line items, and you want to use that total value in the Number of Line Items Total field.
Use this procedure to count line items and generate a control total for an outbound ANSI X12 purchase order.
- Double-click the P0101 element (in the P01 segment in the
P01 group). This is the element that you typically use to count the
line items.
The system displays the Element Properties dialog box.
- Select the Standard Rule tab.
- From the standard rule list, select Use Accumulator.
- Click New.
The system displays the Edit Accumulator Entry dialog box to create a new calculation for this element.
- From the Primary Accumulator list, select 0.
Note: There is only one set of accumulators for each map. This means that accumulator 0, whether it is used in the Primary Accumulator or Alternate Accum box is the same accumulator with the same contents. If you assign calculations to accumulator 0 at the beginning of the map and then use accumulator 0 again later in the map, the content of that accumulator is the result of the earlier calculation. Any additional calculations you assign to that accumulator are performed on the contents resulting from an earlier calculation.
- In the Name box, type Line Item Number. This is a descriptive alias that enables you to differentiate what the accumulators you create are used for.
- From the First list, select Increment Primary. This is the first operation that the system performs. This specifies that the system will increment the PO101 element by one.
- From the Second list, select Use primary. This is the second operation that the system performs, after the First operation is completed. This specifies that the system loads the current value of the accumulator into the P0101 (Assigned Identification) element.
- Click OK to add the accumulator.
- Click OK on the Element Properties dialog box to add the standard rule to the P0101 element.
- Double-click the CTT01 element (in the CTT segment). This
is the element that typically contains the total number of line items.
The system displays the Element Properties dialog box.
- Select the Standard Rule tab.
- From the standard rule list, select Use Accumulator.
- Click New. The system displays the Edit Accumulator Entry dialog box to create a new calculation for this element.
- From the Primary Accumulator list, select primary accumulator 0. This accumulator currently contains the total number of line items.
- From the First list, select Use primary.
This specifies that the system loads the current value of the accumulator
into the CTT01 (Number of Line Items Total) element.
This diagram illustrates how the Edit Accumulator dialog box should look.

- Click OK to add the accumulator.
This diagram illustrates how the Standard Rule tab should look.

- Click OK on the Element Properties
dialog box to add the standard rule to the CTT01 element. Note: The CTT01 element now contains the total number of line items in the purchase order.