GXS AI: Tutorial, lesson 2

Now we need to create the source and target structures – the translator will use them for parsing the input and generating the output documents.
I’ll show you how to describe the source structure and you’ll be able to create the target yourself. Let’s start:

  1. Select the “Document” element on the left (source) side.
  2. In the top menu select Model->Insert Item->Below
  3. On the “DMI Attribute” tab change the following parameters:
    1. Name = LIN
    2. Access Type = LineFeedDelimRecord. So, now it’s not a group but a record.
    3. Min/Max = 1/100. They are the minimum and maximum of repetitions.
    4. Match Value = LIN. It’s a very important parameter – the translator uses it to recognize the LIN records in the source document.

    5. Now we need to move the LIN record under the root group “Document”. To do it, select the record and click this icon:



      You should get the following:



      If you accidentally shifted an incorrect element, you can move it back by clicking on opposite button (“move left”). But be careful – sometimes you cam break your entire structure if you move your elements back and forth.
  4. So, we’ve created our record LIN. Now it’s time to add the fields to it. Select (activate) the record and select Model->Insert Item->Below in the top menu.
  5. As you remember (I hope) the first element of the format A (source) is the Record ID (LIN). However we’ve already described this field as the “Match Value” parameter (Match Value = LIN, see above). That’s enough – when the translator meets the string starting with “LIN***” it will proceed to the next field (Line Item ID).
  6. Thus, the first field of the LIN record will be the Line Item ID. Change the name of the new element you’ve just added to LineItemID (without spaces!)

  7. Now change:
    1. Access Type to AlphaNumericFld (element type = field, type = AN)
    2. Occurence min/max to 1/1
    3. Size min/max to 12/12. Why 12/12 insted of 1/12 ? Because we use a fixed length format, i.e. fields will always have the same length. If the field’s data has the length of 5 instead of 12, it will be populated with spaces (for AN fields) or “0” (for numeric fields) up to the max length.
  8. Shift the field under the LIN record with that familiar icon:

  9. Save the model (it’s not a bad idea to save your model from time to time 🙂 ).
  10. Add the rest of the fields. Select LineItemID, click Model->Insert Item->Below and so on. For the numeric fields (Quantity and Unit Price) choose the Access Type of AlphaNumericFld, not Numeric. For the source document we won’t check the datatype of these fields. For the Expiration Date field select the Access Type of DateFld and format of YYYYMMDD:

So, we’ve just described our source structure (format A).

Now do the same for the target structure. You’ll see that you cannot use the same names 🙂 Hint: you can change the elements’ names.

Gennady Kim

Advertisements

One thought on “GXS AI: Tutorial, lesson 2

  1. Pingback: GXS AI: Tutorial, lesson 1 | EDI shortcuts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s