Creating Temporary Records--Example

To map the shipping information from the Input side of your map (from the N1 Group that repeats a maximum of 200 times) to the ShipTo record in your application file format (that does not repeat), you need to create a temporary storage record and fields on the EDI side of the map that do not repeat. Then, you use an extended rule to extract the shipping and billing information from the N1 group and move it to the appropriate temporary storage elements. Finally, you map the shipping and billing information directly from the temporary storage elements to your application fields.

First, you need to create a temporary storage record and fields on the EDI side of the map that do not repeat. The temporary record is located outside the N1 Group at the same hierarchical level as it, and has a maximum repeat number of 1 (it does not repeat). Then you will create the appropriate temporary fields. After that, create an ON_END extended rule for the N1 Group that assigns the necessary information to the temporary fields.

Use this procedure to create the ShipToDet temporary storage record.

  1. Highlight the N1 group. The two temporary storage segments are located after the N1 group, at the same level.
  2. Select Edit > Insert > Segment. (You select Segment instead of Record because you are creating the temporary record on the EDI side of the map).

    The EDI Segment Properties dialog box is displayed.

  3. In the Name box, type ShipToDet.
  4. In the Description box, type Ship To Details.
  5. Select the Tag tab.
  6. In the Tag box, type $$$.
    Note: The system does not read a segment with a value of $$$ in the Tag box. Therefore, it does not flag this temporary storage segment as an error during compliance checking.
  7. Click OK to create the ShipToDet temporary storage segment.
  8. Create the appropriate temporary fields, for example:
    • SHIPTONAME
    • SHIPTOADDR1
    • SHIPTOADDR2
    • SHIPTOCITY
    • SHIPTOSTATE
    • SHIPTOPCODE
  9. Right-click the N1 group and select Extended Rules to display the Group Properties dialog box.
  10. Select On End. This specifies that the rule is executed when the loop terminates. The system loads an occurrence of the N1 group (containing the billing or shipping information), and then executes this rule.
  11. In the Editor list, type the following:
    IF #0098 = "BT" THEN
    BEGIN
      $850.#BILLTONAME = #0093;
      $850.#BILLTOADDR1 = #0166;
      $850.#BILLTOADDR2 = #0166:2;
      $850.#BILLTOCITY = #0019;
      $850.#BILLTOSTATE = #0156;
      $850.#BILLTOPCODE = #0116;
    END
    IF #0098 = "ST" THEN
    BEGIN
      $850.#SHIPTONAME = #0093;
      $850.#SHIPTOADDR1 = #0166;
      $850.#SHIPTOADDR2 = #0166:2;
      $850.#SHIPTOCITY = #0019;
      $850.#SHIPTOSTATE = #0156;
      $850.#SHIPTOPCODE = #0116;
    END
    Note: If a segment/record or element/field occurs more than once in a map, it is identified by its name <ID>. The second and subsequent occurrences are identified by <ID>:n, where n is the number of occurrences in the map.
  12. Click Compile to validate the syntax of the extended rule.

    Every rule in the map is compiled when you compile the translation object, after you complete the map. However, the system allows you to compile each rule individually, so that you can verify the accuracy of the rule after you create it.

    This compiles the rule interactively, and allows you to correct any errors that are generated. Any errors or warnings generated in the compilation process are displayed in the Errors list.

  13. Click OK to add the extended rule to the N1 group.
  14. Link the temporary fields on the Input side of the map with the corresponding Output fields.