Count Line Items
About this task
In this example, you want an incremental count of the number of line items, and you want to use that count in the Number of Line Items Total field.
To count line items and generate a control total for a purchase order:
Procedure
- Double-click the field that you typically
use to count the line items.
The Field Properties dialog box opens.
- Click the Standard Rule tab to access the standard rule options.
- From the standard rule list, select Use Accumulator.
- Click New.
The Edit Accumulator Entry dialog box opens to create a new calculation for this field.
- From the Primary Accumulator list,
select 0.
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 field, 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.
The line item number is a descriptive alias that enables you to differentiate what the accumulators you create are used for.
- From the First list, select Increment
primary.
Increment primary is the first operation performed. The value in the accumulator increments by one for each iteration of the current group.
- From the Second list, select Use
primary.
Use primary is the second operation performed, after the first operation is completed. The current value of the accumulator is loaded into the Assigned Identification field.
- In the Edit Accumulator dialog box, click OK to add the accumulator.
- In the Field Properties dialog box, click OK to add the standard rule to the Line Items field.
- Double-click the field that typically contains
the total number of line items.
The Field Properties dialog box opens.
- Click the Standard Rule tab to access the standard rule options.
- From the standard rule list, select Use Accumulator.
- Click New.
The Edit Accumulator Entry dialog box opens to create a new calculation for this field.
- From the Primary Accumulator list,
select 0.
This accumulator currently contains the total number of line items.
- From the First list, select Use
primary.
Use primary specifies that the current value of the accumulator is loaded into the Number of Line Items Total field.
- In the Edit Accumulator dialog box, click OK to add the accumulator.
- In the Field Properties dialog
box, click OK to add the standard rule to the
Number of Line Items Total field.
The Number of Line Items Total field now contains the total number of line items in the purchase order.