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

  1. Double-click the field that you typically use to count the line items.

    The Field Properties dialog box opens.

  2. Click the Standard Rule tab to access the standard rule options.
  3. From the standard rule list, select Use Accumulator.
  4. Click New.

    The Edit Accumulator Entry dialog box opens to create a new calculation for this field.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. In the Edit Accumulator dialog box, click OK to add the accumulator.
  10. In the Field Properties dialog box, click OK to add the standard rule to the Line Items field.
  11. Double-click the field that typically contains the total number of line items.

    The Field Properties dialog box opens.

  12. Click the Standard Rule tab to access the standard rule options.
  13. From the standard rule list, select Use Accumulator.
  14. Click New.

    The Edit Accumulator Entry dialog box opens to create a new calculation for this field.

  15. From the Primary Accumulator list, select 0.

    This accumulator currently contains the total number of line items.

  16. 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.

  17. In the Edit Accumulator dialog box, click OK to add the accumulator.
  18. 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.