Creating transaction sets

To generate transaction sets, use a functional map.

For example, to generate each #850 transaction set, use functional map Make#850.

Each transaction set has its own envelope. The transaction header contains the transaction code (for example, 850 for purchase orders) and a control number.

The transaction set control number is typically a relative control number that starts at 1 for the first transaction set and increments by 1 for each successive transaction set within the same functional group. However, you can use any control number scheme that you want.

To increment the transaction set control number by 1, make one of the arguments to the functional map the expression INDEX($).

Note: The actual TSCtrl# Element is defined as text. If you want to use TSCtrl# Element as the input card type in the Make#850 map, use the TEXT function on INDEX($) to convert the INDEX value to text.

This rule generates a Transaction #850 for each POHeader Record whose Dealer Field matches the Dealer of interest. Each time the Make#850 map is evaluated, the last argument is evaluated to the index of the current Transaction #850. For example, the first time the rule evaluates, INDEX($) evaluates to 1. The second time the rule evaluates, INDEX($) evaluates to 2, and so on.

In the Make#850 map, the evaluated result of INDEX($) can be mapped to the transaction control number.

The InclSegments Element in the SE Segment needs to be the count of all segments that are generated within the transaction set. To calculate this element, you would use the following rule, where #850TransactionSet is the name of the card:


COUNT (Segment IN #850TransactionSet) + 1

Segment is a partitioned type. When you use the COUNT function on a partitioned type, all of the types in its subtree are counted. All subtypes of Segment are counted. You add 1 to the count to account for the SE Segment, which will not yet be generated at the time the rule is evaluated.