cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a node for every occurance of multiple source nodes

Former Member
0 Kudos

Hello,

We have a need to modify an existing map in PI and I'm not quit sure how to go about it.  The Source and Target structures are shown below.  The current map is pretty simple, for every ocurrance of source node TBLX20, one <item> target node is generated.  We've recently added the new source node TBLX2P (indicated in italics).  The new requirements is:  for every occurance of TBLX20 AND TBLX2P, generate a <item> target node. 

Source Structure

<TBLX20>

     <cond_num>

     <descr>

</TBLX20>

<TBLX2P>

     <promo>

     <promo_num>

</TBLX2P>

Target structure

<item>

     <cond_num>

     <item>

     <eventid>

</item>

In the example below, I've outlined a common scenario, were you have 2 TBLX20 source nodes and 1 TBLX2P nodes, and 3 <item> nodes are generated.  There is no corrolation between the number of TBLX20 and TBLX2P records exists in a single Instance.

Source Message Instance

<TBLX20>

     <cond_num>

     <descr>

</TBLX20>

<TBLX20>

     <cond_num>

     <descr>

</TBLX20>

<TBLX2P>

     <promo>

     <promo_num>

</TBLX2P>

Expected output message

<item>

     <cond_num>

     <item>

     <eventid>

</item>

<item>

     <cond_num>

     <item>

     <eventid>

</item>

<item>

     <cond_num>

     <item>

     <eventid>

</item>

Your help is greatly appreciated!

Jose

Accepted Solutions (1)

Accepted Solutions (1)

former_member184681
Active Contributor
0 Kudos

Hi Jose,

The solution for you is quite simple. In your mapping, right-click the target <item> node and choose Duplicate node. This will create another copy of the node, so that you could create mapping based on both your source nodes independently (one to each item copy), just as for two different targets. The rest happend automatically.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

I'd like to expand this question just a bit if its okay with you?  I did as you suggested, I created a duplicate node and created a map based on a bolean function, if <TBLX2P> exists...but I'm having issues with keeping the context of the Source structure when mapping it to the Destination.

For example:

When mutliple TBLX20s exist (which in most is likely in most cases), then the ones containing the X2P are being generated, but with mapped with wrong values, and the X20s without X2Ps are being ignored all together.

Is there an easier way to do this?

Thanks in advance,

Jose

Answers (1)

Answers (1)

Former Member
0 Kudos

Yup, that did the trick, thanks Greg!