cancel
Showing results for 
Search instead for 
Did you mean: 

required ouput..

Former Member
0 Kudos

I am adding two files to one and sending to receiver in this if I get N as occurance of file1 and M as occurance of file2 then I need to get N+M occurance for received file

for exaple if I have 2 occurance and file 1 and 3 occurance for file 2 at this time I need to get 5 as occurance for receiver file

for exaple if I am having two files like this

file1

<e1>

<a1>

<b1>

</e1>

<e1>

<a2>

<b2>

</e1>

file2

<e2>

<d>

</e2>

OUTPUT FILE

<out>

<a1>

<b1>

</out>

<out>

<a2>

<b2>

</out>

<out>

<d>

<f>

</out>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You have to use BPM with fork for this since there are two files coming in the source side.

Since in your case there are 2 source files coming, so you need to use a BPM with 2 receivers for the 2 source files, one each in one of the branches of a fork, i.e you need a fork step with 2 branches. Then after the fork step , you need to insert a transformation step where you have to do the required message mapping.After the message mapping, insert a send step which will send the output of the message mapping to the intended receiver.

In the message mapping, you need to have 2 source structures for the 2 source files i.e. there should be 2 source message types in the message mapping. Then you need to use the count node function for both the source messages to count the number of occurrences of the parent node in each of them, and then use the add node function to count the total number of occurrences of the target node and map this to the target side's parent node.

After that, simply map the child node(child1 and child2) of both the source structures directly to the child node in the target side.

MT1

<Node1>

<child1>

MT2

<Node2>

<child2>

MT_TARGET

<NODE>

<child>

Map both <child1> and <child2> with the same <child> node of the target.

Thanks

Biswajit

Edited by: 007biswa on Feb 14, 2011 2:42 PM

Edited by: 007biswa on Feb 14, 2011 2:44 PM

hemant_chahal
Contributor
0 Kudos

Hi Prasad,

Try duplicate subtree in the mapping for target.

Map e1 to first subtree and e2 to duplicated subtree.

Hemant