Skip to Content

Advanced XI Mapping useful with MDM


This weblog explains a mapping that could be used when distributing data from MDM XML files
to databases using XI. The source message has different records that
need to be updated in a database if and only if they have a key field defined.


        image
     


    In the following example, the key is the field CR. The first record has a key CR=1
    so it must be mapped into an UPDATE statement. The second record does not define a
    CR key field so it is not converted into a statement.
   
        image
     


Target Message


        image
     


Tasks to be completed

    • Map the statement field.

This can be easily done by assigning the key
      CR to the Statement under the root context. Explicitly as follows:
      /ns:MsgTypeUpd/Statement = /ns:MsgTypeSrc/M1/CR

    1. Map each target field. Each target is mapped with the corresponding
      source field if and only if the key exists for that record


    We can check weather the key exists by using the exists block
    and the ifWithoutElse block. Apart from that, we’ll
    have to make sure that no context is empty, that’s why we are removing
    the contexts and then splitting the fields.
   


        image
     

The queues from a test are shown below, it is clearly seen that the element “4444”
remains unassigned because a key is missing at that same position.


        image
     

This solution is good enough if the number of fields in the table is small,
but if there are several of them it would be better to create a “User defined
function” to make the job. The mapping would look like,


        image
     


      For this implementation we are supposing that the key field has cardinality 0..1
      and that each field has cardinality 1. This is not always the case. I promise I’ll
      post an upgraded version of this ifExists function block with more functionality
      and completely tested in different structures.
   


        image
     

To report this post you need to login first.

2 Comments

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

  1. Anonymous
    Javier-

    I fail to understand what is “Advanced” mapping in this blog, but may be its just me. I guess there are a couple of documents and weblogs published already, on the advanced mapping capabilities of XI? Hope you have verified them before drawing up this blog.

    Thanks
    KK

    (0) 
  2. Anonymous
    There are lots of weblogs related to mapping but I have not found any blog that deals with this conditional assignment, has someone found one? This problem is so common that I think there is a real need to create a new mapping block for this kind of assignments. Don’t you think so?
    (0) 

Leave a Reply