Map Editor looks like all the other mapping tools – source structure on the left side and target structure on the right. There are 3 ways for mapping the data from the source to target structure:
Simple Links – when you simply connect field from the input to the output. You can drag&drop a field from a left side to the right. If you are trying to connect fields with the different types (String to Number or Date), or from different levels (Header to Line Item) or from repeatable element to non-repeatable (and vice versa) it will show you an alert message:
As I wrote before, I’m often trying to use/create some tools/scripts which helps me to do different things – build the test data, compare outputs or check the models. For example when I was working a lot with GXS AI I created a tool which showed me the list of the variables and arrays used in the maps + some “assumptions” (for example, if a variable is not used). Also, it generated a code to check all the arrays (they all should be empty at the end of the translation). It helped us to keep the maps clean. There is no Print to File option in GXS AI Workbench (like Sterling’s MapEditor has) so often it was hard to see the whole picture, especially when the map contained hundreds or thousands lines.
Such tool would also help you to migrate maps from GXS AI to Sterling GIS/SI (or another EAI) and back.
Here are some screenshots just to give you an idea:
I see a lot of requests about training/documentation/tutorials for Gentran/GIS/SI. Maybe, one day I post some basic things about SI/GIS administration and maps, but now I’d like to share some links to very useful documents from IBM. Now they have a very good online documentation, but I’m also using PDF files from FTP:
The other day I was working on an XSLT map for webMethods. In that map I needed to calculate a unit price using the gross price and the price basis. I.e. for example if the price is $1,250.00 per thousand, the unit price will be $1250/1000 – $1.25 per unit. Besides the map itself, the system used several pre and post processors for some additional data changes, and I was getting ‘NaN’ instead of expected $1.25. I’m not a big expert in webMethods, I was not sure about all the pre/post processors used, so I did the following: I changed the map to put both the price and the price basis into the text fields (in my case it was X12 810, IT1-04 so I used IT1-07 which is AN1..48). And I found that the price was “1250” (as expected) but the price basis was “TP” (X12 4010, 639 Basis of Unit Price Code, TP = Price per Thousand) instead of “1000”. I.e. the system converted my “1000” into “TP”, that’s why it was ‘NaN’ in the output (1250/TP = NaN). It became clear why I was getting this error and I was able to fix the map. So, often there is a way to make a “black box” a little bit clearer – you just need to redirect you questionable data into text elements.
Variables (and Arrays)
In this lesson we’ll see how to use variables and the difference between variables and arrays.
It’s time to start working with more complex structures which are more similar to the “live” documents. We’ll be using our map “example02” we created on previous step as the base. Let’s change it.
First of all, we need to change the structures of both source and target documents. In the real life documents usually contain three main parts (blocks of data):
- Header. This block usually contains the document number/date, addresses and so on – the common information.
- Details. Usually there some kind of a repeatable data (Line Items and their IDs, names, quantity, price and so on)
- Summary section. This block contains all the total amounts, taxes/fees, total quantities and so forth. This section is very similar to the Header section, but often it is placed at the end of the document to emphasize its “summary” role (like you can see in the paper documents).
Arrays of data
In this lesson I’ll introduce you a concept of arrays in GXS AI.
Our first map we created on previous lesson is pretty simple. Both source and target have almost the same structure, only one type of records and a few fields. In real life such maps are very seldom. So, we need to gradually work on more and more complicated maps. Let’s get started!
If you work as a map developer, and your clients use different versions of GIS/SI (and different Sterling Integrator Map Editors), one day you might want to use a map from the higher version of GIS/SI in lower version. There is no problem for the opposite situation, but if you try to open a map created in Sterling Integrator Map Editor 6.4 in Sterling Integrator Map Editor 5.3 (for example), you’ll see something like this (“This map was saved by a newer version. You must upgrade in order to open this map.”):
Creating the simple links
Now, when both source and target models are ready, we can continue.
We’ll start with the “simple links” – very, well, primitive 🙂 technique, which “explains” to the translator how to create the target document using the source data. Usually, the simple links are used in very simple cases – when the target structure is similar to the source.
Our example is pretty obvious – the data from Line Item ID, Quantity, Unit Price and Exp. Date from the source document go into appropriate fields of the target one. Both structures are almost the same – repeatable records of the same type. So, the simplest solution here is to use the simple links.
To create the simple rules, open the map, select the first field for linking – LineItemID, leftclick on it and holding the button move the pointer to the target LineItemID (drag and drop). You’ll see a blue line connecting both elements (see below). This line means that the data from the source’s LineItemID will go to the target’s LineItemID.