The exercise you just completed demonstrated how quickly and easily you can create and run a map with ECMap. You are now introduced to the features that really set this mapping tool apart from the competition. ECMap’s rich array of rule commands, flexible cross-reference functionality, conditional logic, and simple yet powerful memory variables allow you to imbed complex business rules into your maps and seamlessly integrate applications.
For the final portion of this exercise, you use memory variables, rule commands, and a cross-reference table to convert information imbedded in a description field in your application and include it in the purchase order (X12 850 Transaction Set) that you are sending to your trading partner. If the item is a computer, the description field is used to find the product line code for that computer. If the item is not a computer, the accessory product code is used.
Steps:
Select Mapping on the toolbar or Workspace. The Mapping – Application to X12 window displays. Notice that there are now levels on the Destination: X12 section on the right side of the window. These levels were automatically assigned by ECMap when it created the flow.
On the Destination: X12 section of the window, double-click the PO1 segment to display the elements.
Creating memory variables
You can create Memory Variables in more than one way - from the Tools menu on the main ECMap window and in several places on the mapping window.
Right-click PO1 09 (Product/Service ID) and select Memory Variable from the drop-down menu.
Source: Memory Variables now appears on the left side of the window in place of the Source: Application Data.
Right-click the Application Directory: Memory Variables under Source: Memory Variables, and select New from the drop-down menu.
The New Memory Variables window displays, with two tabs – Fields and Options.
In the Memory Variable Name text box on the Fields tab, enter Product_Line_Desc. The Memory Variable Description is optional. Select the Field Type text box, and begin typing AN-Alpha Numeric or select it from the drop-down list. Select the Field Length text box and enter 15. Select OK to return to the main mapping window.
All you need to do is begin typing a valid field type in the text box, and ECMap automatically completes it and enter it in the text box.
Right-click the Memory Variables application directory and select New from the drop-down menu. The New Memory Variables window displays again.
In the Memory Variable Name text box on the Fields tab, enter Product_Line. The Memory Variable Description is optional. Select the Field Type text box, and begin typing AN-Alpha Numeric or select it from the drop-down list. Select the Field Length text box and enter 13. Select OK to return to the main mapping window.
Right-click the Memory Variables application directory and select New from the drop-down menu. The New Memory Variables window displays again.
In the Memory Variable Name text box on the Fields tab, enter Convert_Success.
The Memory Variable Description is optional. Select the Field Type text box, and begin typing AN-Alpha Numeric or select it from the drop-down list. Select the Field Length text box and enter 1. Select OK to return to the main mapping window.
Mapping a memory variable
Drag the memory variable Product_Line from the Source: Memory Variables section and drop it on PO1 09 (Product/Service ID) in the Destination: X12 section of the window.
Mapping a constant
X12 syntax rules require a qualifier for an ID code.
Right-click PO1 08 (Product/Service ID Qualifier) and choose Constant from the drop-down menu. The Constant dialog box displays.
In the Enter Constant text box, type ZZ. Select OK to exit the Constant dialog box and return to the main mapping window. The constant ZZ is mapped to PO1 08.
Creating and using rule commands
ECMap enters 1 as the Line Number for the first command in a rule. Each time you add a new command, ECMap automatically enters the line number based on the option you chose for adding a new command.
From the Element menu on the Mapping– Application to X12 window, choose Rule. From the Rule submenu, choose Prior. Rule Definitions displays on the left side of the window, with three rules listed. The 0 Do Nothing rule is automatically created for every map. ECMap created the 20 READ ORDER-HEADER rule and the 30 READ ORDER-DETAIL when it created the map flow.
Right-click the Rules application directory and choose New from the drop-down menu. The Rule Definition – New window displays.
In the Rule Number text box, enter 40. In the Rule Description text box, enter Convert Product Line Code. Select OK to return to the mapping window. Rule 40: Convert Product Line Code now appears in the list of rules under Rule Definitions.
Right-click Rule 40: Convert Product Line Code and choose New Command from the drop-down menu. The Rule Command – New window displays. ECMap automatically enters the Rule Number and Line Number.
In the Command text box on the Rule Command – New window, begin typing the command Substring or choose Substring from the drop down list. A Parameters section appears at the bottom of the window, with four text boxes.
All you need to do is begin typing a valid rule in the text box, and ECMap automatically completes it and enter it in the text box.
Select the Source String up arrow and choose Record/Field from the drop-down list. The Records/Tables window displays. Double-click the ORDER-DETAIL record to display the fields. Double-click the DESCRIPTON field in the ORDER-DETAIL record to enter ORDER-DETAIL/ DESCRIPTON in the Source String text box. Choose Close from the File menu to close the Records/Tables window.
Select the Substring Start up arrow and choose Constant from the drop-down list. The Constant Value dialog box displays. In the Enter a Constant Value text box, enter 1. Select OK to close the dialog box and enter the value in the Substring Start text box.
Select the Substring Length up arrow and choose Constant from the drop-down list. The Constant Value dialog box displays. In the Enter a Constant Value text box, enter 15. Select OK to close the dialog box and enter the value in the Substring Length text box and exit from the window.
Select the Destination String up arrow and choose Memory Variable from the drop-down list. The Memory Variables window displays. Double-click Product_Line_Desc to enter it into the Destination String text box. Choose Close from the File menu to close the Memory Variables window. Select OK to close the Rule Command – New window and return to the mapping window.
Creating and using a cross-reference table
Cross-reference tables can be added as part of a rule using the Table Conversion command, or they can be independently created and attached to an element.
In the Rule Definitions section, right-click Rule 40: Convert Product Line Code and choose New Command from the drop-down menu. The Rule Command – New window displays.
In the Command text box on the Rule Command – New window, begin typing the command Table Conversion or choose Table Conversion from the drop down list. A Parameters section appears at the bottom of the window, with six text boxes.
Select the Conversion Table up arrow and the Cross Reference Tables window displays. Choose New from the File menu, and the New Cross Reference Table window displays.
ECMap automatically enters the Project and Map name. Enter ProdLine - the name of the cross reference table - in the File Name text box. (This name must be 8-characters or less.)
As the Standard Field Length, enter 13. As the Application Field Length, enter 15. Under Standard Field Number, select No Field Number. In the Description text box, enter Converts computer name to product line. Select Create.
The Cross Reference Table Properties window displays, with ProdLine automatically entered as the Table name. Choose New from the File menu. The New Cross Reference Entries window displays, with the same Table name automatically entered.
On the New Cross Reference Entries window, enter the conversion formulas to be used in the cross reference table you are creating. For EDI Value, enter PE6300 Series. For Application Value, enter PowerEdge 6300. For Description, enter PE6300 Series.
If you are making multiple entries into the cross reference table, you would select Next to apply the current entry and bring up a new window to add another entry.
Select OK to return to the Cross Reference Table Properties window. Choose Close from the File menu to return to the Cross Reference Tables window.
Double-click ProdLine on the Cross Reference Tables window to enter it in the Conversion Table text box. Choose Close from the File menu to close the Cross Reference Table window.
Select the Source Variable up arrow and choose Memory Variable from the drop-down list. The Memory Variables window displays. Double-click Product_Line_Desc to enter it in the Source Variable text box.
Select the Destination Variable up arrow and choose Memory Variable from the drop-down list. Drag Product_Line from the Memory Variables window and drop it in the Destination Variable text box.
You can either double-click the memory variable to enter it in the text box, or you can drag and drop it into the text box. ECMap often gives you several ways to perform an action so that you can tailor mapping to your style.
Select the Status Variable up arrow and choose Memory Variable from the drop-down list. Either double-click Convert_Success to enter it in the Status Variable text box or drag and drop it into the text box. Choose Close from the File menu to close the Memory Variables window.
Select the On Failure, Return up arrow and choose Constant from the drop-down list. The Constant Value dialog box displays. In the Enter a Constant Value text box, enter Accessory. Select OK to close the dialog box.
Select the On Failure, Generate up arrow and choose No Error Message from the drop-down list. Select OK on the Rule Command - New window to return to the mapping window. Choose Close from the File menu of the Mapping- Application to X12 window to return to the main ECMap window.
If you are adding multiple commands, select Apply. The current command is added to the rule and a blank Rule Command – New window appears.
Associating the rule with an element
Drag Rule 40: Convert Product Line Code from the Rule Definition window to the Destination: X12 window and drop it on the PO1 09 (Product/Service ID). It displays beneath as Rule: PRIOR 40.
Regenerating and rerunning the map
Now that you have added additional functionality to your map, all you need to do is generate the map again and then run it.
Follow the instructions for Step 3. Run Your Map (starting on page E-47 of this document).
When you have successfully generated and rerun your map, select View EDI File. The output now includes the product line codes that we mapped using memory variables, rule commands, and a cross reference table. The output should look like the sample on the next page.
ISA*00* *00* *01*033459876 *01*024509876 *990808*1201*U*00200*000000001*0*P*> GS*PO*033459876*024509876*19990808*1201*0*X*004010 ST*850*1 BEG*00*SA*PO1133557799-1**19990109 N1*ST**1*027364321 PO1**160*EA*198.00**VN*11410-CP**Accessory PO1**8*DZ*157.00**VN*21410-ZD**Accessory PO1**32*EA*653.99**VN*31420-CP**PE6300 Series PO1**16*EA*193.50**VN*41420-HD**Accessory SE*8*1 ST*850*2 BEG*00*SA*PO321335577-1**19990109 N1*ST**1*023364990PO1**20*EA*79.98**VN*11409-CP**Accessory PO1**8*EA*193.50**VN*31420-CP** PE6300 Series PO1**3*2D*99.00**VN*21409-ZD**Accessory SE*7*2 GE*2*0IEA*1*000000001