I think every user of the Graphical Mapping tool has already used the boolean function ifWithoutElse and knows about the node function createIf. I want to show how the Mapping Tool interprets these function and how the internal representation with the special string constant suppress looks like.
If you do not know, how queues and contexts work, read first Venkat Donela’s weblog Introduction to queues in message mapping
The boolean function ifWithoutElse
This function is always used, when you want to choose to correct data for a single element. Look at this example:
We want to choose the Material text in English and move it to the target source. The texts in the other languages are not relevant.
We define the mapping as follows:
The context references of LANGKEY and TEXT are set to MATERIAL to have all entries of the elements in the same context.
Let us now look at the queues:
In this picture you see the value suppress with light blue colour in the queue (the appearance is different, but similar in SP13). The Mapping Tool chooses the correct context and takes the first value which is not suppress. If you have an obligatory field (occurrence 1:n) then you have to assure that there is at least one valid entry in the context.
The node function createIf
This function is used when you want to select a whole node with all sub-nodes or elements.
Look at this example:
We want to map the Business Address to the target. Of course, we could use the function ifWithoutElse for every element, but a quicker and more elegant solution is using the function createIf:
And we map the elements just that way:
When we now compare the queues for the target elements ADDRESS and STREET, then we can see how the value suppress keeps the queue in range and guaranties the choice of the correct values:
For the node ADDRESS the Mapping Tool takes the values which are not suppress from the first context. For the elements beyond ADDRESS the Mapping Tool considers the corresponding contexts. In our example all values of the second context are taken. There is no need to have conditions on the sub-nodes.
I thank Joachim Orb for providing the examples.