Calculating Hash Totals

In this example, you want to count the quantity ordered for each line item and load the total quantity in the CTT02 (Hash Total) element.

Use this procedure to count the quantity ordered and generate a hash total for an outbound ANSI X12 purchase order.

  1. Double-click the P0102 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.

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

    The system displays the Edit Accumulator Entry dialog box to create a new calculation for this element.

  5. From the Primary Accumulator list, select 1.
  6. In the Name box, type Total Quantity.
  7. From the First list, select Hash Sum in Primary. This is the first operation that the system performs. This specifies that the system will add the numeric value of the PO102 element to the contents of the Primary Accumulator.
  8. Click OK to add the accumulator.
  9. Click OK on the Element Properties dialog box to add the standard rule to the P0102 element.
  10. Double-click the CTT02 element (in the CTT segment). This is the element that typically contains the total quantity of the purchase order.

    The system displays the Element Properties dialog box.

  11. Select the Standard Rule tab.
  12. From the standard rule list, select Use Accumulator.
  13. Click New.
    The system displays the Edit Accumulator Entry dialog box to create a new calculation for this element.
  14. From the Primary Accumulator list, select primary accumulator 1. This accumulator currently contains the total quantity.
  15. From the First list, select Use primary. This operation specifies that the system loads the current value of the accumulator into the CTT02 (Hash Total) element.
  16. Click OK to add the accumulator.
  17. Click OK on the Element Properties dialog box to add the standard rule to the CTT02 element. The CTT02 element now contains the total quantity of the purchase order.