Here is why the map looks like it does: heavens knows I have gone down this thought process:
‘I want to create a LOC_2 repeating record for each ShipmentStatus element and I also want to create a LOC_2 for every DeliveryCode element. The looping functiod means I want to create a record for whatever is the source, simply linking two of these should work.’
Unfortunately, the looping funtiod can only be one output, not two looping functiods to the same output.
Here is the input and output definitions:
Here is some sample data:
I have created a sample that shows how to solve the problem, one the hard way, the other the easy way.
First the hard way:
Let me explain how you need to think how the out of the box functionality:
"I need to load all of the data into a repeating temporary table and then extract data from the table into the output structure"
Using out of the box functiods:
You want to use the table looping functoid and table extractor functiods
The arguments to the table looping functiod are:
The ones that are really important are the input, input,input, and input, the other ones are hard coded data.
Input is the scoping, generally the root node.
Input is how big the table is going to be (generally the number of output elements you need to create) (we will see the importance in a moment).
Input and Input are the drivers to the creation of the output records.
Now lets look at the table
I put Data1 and Data2 as the first column (even though it won’t be the first output) and marked the Gated check box, so that if there is no Data1 or Data2 in the input, no empty records be created. For each Data1 record, I am going to create a record and hard code 11, C571data1 and C571data2, for every Data2 I will hard code 12, C571data3 and C571data4 (they could have been links from the source if I wanted)
Now the output:
The link from the table looping functiod is linked to the LOC_2 record (which repeats)
The table extractor functiods are as follows:
The top table extractor functiod’s argument is 2 (exctract column 2 (value 11 or 12)
The next one under is 1 (column 1′s data)
The one after that is 3, and then 4
This returns a result set:
(not easy to understand however)
Now the easy way:
The easy way is to think of it, like I described
"I want to create a structure that needs to be sourced from a repeating structure, and I also need to create the same structure based on a different source element."
So we start by dragging the first ‘source’ to the destination and going into the properties of the other elements and hard coding something
and I went into the LOC01 and C5172, and C5173 and hard coded it:
Now, I validate the map and see the output xsl:
We want to create a ns0:Output and then we loop through each Data1 and then put data in LOC01 and then map the Data1/text() in the C5171, and put some data in the C5173, pretty easy to understand thus far.
So let me change the data to match the previous map:
Now let’s copy the <xsl:for-each node and save it in notepad
Now lets go re-do the map for the second record we want to create
And looking at the xsl (which looks eerily similar)
So I change the xsl
Now I simply copy both of the <xsl:for-each into an inline xsl functiod box and connect the output to the LOC_2 record (no inputs):
Here is what the map looks like:
I validate it and the underlying xsl looks like this:
Which also creates:
Both ways are do-able, I just don’t like thinking that the BizTalk gods at MS put together the functiods. XSL seems more logical to me.