Skip to Content

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.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Jing Wang
    Hi Stefan,

    In the example of “ifWithoutElse” is the Context Change for “LANGKEY” and “TEXT” necessary?  In the Venkat Donela’s weblog Introduction to queues in message mapping you recommended to read first, he did not do any contaxt change for “KEYNAME” and “MATNAME”.

    For the example “createIf” perhaps the Context Change for “TYPE” is also not necessary?

    Jing Wang

    1. Stefan Grube Post author
      It depends on the queue of the parent node whether you need the change of the context for “LANGKEY” or “TEXT”. In both examples the queue of the parent node is not mentioned, in my example I assume the queue of the node “ProductDefinition” has just one entry. Therefore only the first context is relevant for “Description”.

      In Vekat’s example the queue of the parent node “MT_TARGET” should be like this: suppress – space – suppress.

      In the seconde example the target element is based on the source “Address” but in mapping I use the child element “Type” to create the target. So I need to adjust the context of “Type” to “Address”.

      Hope that helps

      1. Shubhankar Mandal

        Hi Stefan,<br/>In my output structure I have phone_1 and Phone_2 and I was trying to pass first Phone to Phone_1 and second Phone to Phone_2 using copyValue function and that is why I think it was not working because copyvalue function works in one context(but I am not 100% sure).. I have written one small UDF and it is working. If you have different thought then please let me know.<br/><br/> int k = Integer.parseInt(b[0]);<br/> if (k<a.length)<br/>     result.addValue(a[k]);<br/><br/>Thanks<br/>Shubhankar


Leave a Reply