cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping question: IDOC to target

former_member611341
Participant
0 Kudos

I have question related to PI mapping.

Requirement:  If there are n occurrences in source node, there should be n+1 occurrences on the target Node2  where the first occurrence is derived from other node field.


Source


<row1>

          <Value>1</Value> 

</row1>

<row1>

          <Value>2</Value>

</row1>

<row1>

          <Value>3</Value>

</row1>

To

<row>

  <Value>A</Value> 

</row>

<row>

  <Value>1</Value> 

</row>

<row>

  <Value>2</Value>

</row>

<row>

  <Value>3</Value>

</row>

How can achieve this? Hope I'm clear with my question.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Duplicate the target subtree in your message mapping and map the original tree with other node field of source and duplicated with the source structure. Duplicate only target subtree

For eg: In message mapping, map like this and check.

MT_Sender                                            MT_Reciever

<other field strcture>             ------------>  <Row>            0.unbound

     <other field>                        ----------->       <value>         0 to 1

<Row1>     0..unbound            ---------->  <Row>             0.unbound

    <Value>    0 to 1                    ---------->        <Value>        0 to 1

Thanks

former_member611341
Participant
0 Kudos

Thanks for your answers.

Muniyappan. - I"m not familiar with UDF so I want to try Sub tree first.

I Tried to add a sub tree, but during the save the sub tree is getting deleted. This is the message im getting during the SAVE ...

" The source structure, target structure, or a function library has been changed or could not be found in the Enterprise Services Repository. The mapping definition contains elements or attributes that do not exist in the changed structure, or functions that were changed in a function library. The relevant entries will be deleted. "

ambrish_mishra
Active Contributor
0 Kudos

Hi,

After you duplicate the subtree, you need to create the node based on a condition. Can you give a screenshot of your mapping and rules involved. It should be easily achieved.

Ambrish

Muniyappan
Active Contributor
0 Kudos

Hi,

Are you trying to add sub tree in message mapping or data type?

share your input and output xml.

Regards,

Muniyappan

former_member611341
Participant
0 Kudos

After creating a Node it worked.  Thanks Ambrish.

One more thing is there way i can have duplicate sub tree above the original tree/node ?

Former Member
0 Kudos

Hello,

The error is quite evident, i think you are trying to save ur mapping object without doing any mapping for the duplicated target node? Map constant to the (row [1] - duplicated node) node and then try to save/activate ur mapping.

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi,

>>One more thing is there way i can have duplicate sub tree above the original tree/node ?

No, it's not possible, but what u can do is u can change ur existing mapping order pertained to duplicated node  and apparently once u do that then u have to redo ur original and duplicated node mapping.

Thanks

Amit Srivastava

ambrish_mishra
Active Contributor
0 Kudos

Hi,

You cannot have the duplicate subtree above the original node.what you can do is create the rule on the original node for the additional node and the rest nodes can follow the other rules.

Hope it helps!

Ambrish

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

if you donw wat to replicate nodes you can see my solution sugguested in my previous post

Answers (3)

Answers (3)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

1)   create a mapping variable

map the variable with the value 0/1 like this

row1--> count --> Greater (Else=0)------>Variable

1---------------------->

2)     in the flow editor of <row[0]>

Variable ---->Equeals --------------->IF--------> UDF--->Value

1-------------->

ELSE

row1-------------------------------->Value

the UDF should receive a 2 input values A(var1) and the queue of row1(var2).

in the logic you will add a new value for resultList

vector v = new Vector();

v.add(var1[0]);

for ( int i=0; i<var2.length; i++ ){

v.add(var2[i] );

}

for ( int j=0; j<v.size(); j++ ) {

String s = (String) v.get(j);

  result.addValue(s);

}

Muniyappan
Active Contributor
0 Kudos

Hi,

check this. not sure if it helps you.

write udf with execution type all values of a context.

right click on value and change the context to idoc

mapping results

Regards,

Muniyappan.

Former Member
0 Kudos

Hello,

Right click on row node and use duplicate subtree option.

Thanks

Amit Srivastava