Skip to Content
avatar image
Former Member

Generating target nodes dynamically in message mapping

Hi XI GURUS

I am trying to generate target node using using more then source node. Is it possible to do this.

I need this as in source I have 2 different nodes (0 to unbounded) and in target I want to create corresponding number of target nodes. For e.g if I have 2 + 1 nodes in source then I want to create 3 nodes in target

Source as below

<FIRSTNAME>

<Raj>

<Kum>

</FIRSTNAME>

<FIRSTNAME>

<Naveen>

<Kumar>

</FIRSTNAME>

<CITY>

<bANGALORE>

</CITY>

Desired output in target as below

<ADDRESS>

<qwerty1>

<ADDRESS>

<ADDRESS>

<qwerty2>

<ADDRESS>

<ADDRESS>

<qwerty2>

<ADDRESS>

Can i follow an alternative approach (using java function) of counting the total number of occurences of source nodes and generating as many number of the target node

Thanx

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 16, 2008 at 02:13 PM

    Hi,

    You can do a 1:1 mapping to create the target node as many time of the source node.

    If you case assuming that the source node are A & B and the targe node as C you may duplicate the target node C in the message mapping(right click--> Duplicate Subtree) and map A & B to twice the occurance of C.

    Thanks

    SaNv...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 16, 2008 at 02:36 PM

    Thanx Santhosh for a quick reply .

    But it seems my problem is a bit more complex and I need to determine the number of output nodes using a java function .

    I can not consider all nodes in the source to be mapped to target. I need to do a condition check on the source nodes before deciding the number of out put nodes.

    Can some thing be done using SplitByValue function . I have used that earlier for creating output elements dynamically but not nodes

    Thanx.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      If you have a condition check for each of the source node to be mapped to the target node,

      use "create if" standard function and pass the boolean result of your Condition check as an input to this standard function. For each "true" a value would be added to the output queue. If you have a simple condition check on some source field value for each correspoding node, use "if without else" or depending on the complexity of the condition you may use a udf to get the boolean outcome.

      And for mapping from more than on type of source node, you may duplicate subtree for target node.

      Regards,

      Suddha

  • avatar image
    Former Member
    Oct 17, 2008 at 04:50 AM

    HI

    You can create the UDF

    1. pass the input string to the queue

    2. Loop to find the length

    3. result.addValue(input)

    This will create the number of nodes equal to the length of queue.

    Thanks

    Gaurav

    Add comment
    10|10000 characters needed characters exceeded