cancel
Showing results for 
Search instead for 
Did you mean: 

Hierarchy mapping problem

Former Member
0 Kudos

Hi!

Here is my problem:

I need to do this mapping:


<Header >(Occ. 1-n)                             
   <Serial_Number>                                  
   <Item>(Occ. 1-n)                                                                        
     <ItemNumber>  
     <Date>                                                                                
</Item>                                            
</Header>                                           

 <Header >  (Occ. 1-n) 
    <Item>(Occ. 1-n)
       <Doc_Number>
       <ItemNumber>
       <Date>   
    </Item>
 </Header>

I need to map Serial_Number to Doc_Number in each Item(Each Header has more than one item)

The problem is that the value pass only to the first Item node, the others stay empty.

Accepted Solutions (1)

Accepted Solutions (1)

former_member187587
Contributor
0 Kudos

inser the <Item>(Occ. 1-n) on the 1st and snd inputs.

Former Member
0 Kudos

BINGO!

I used UseOneAsMany with Document_Number in first inpute and Item in two others.

Thank's Nimrod!

Former Member
0 Kudos

It won't work if you pass Item for both 2nd and 3rd parameter... unless you splityByValue after useOneAsMany.. check my mapping given at the end.

Former Member
0 Kudos

Hi, Anand !

Thank you for help, I'll check it tomorrow.

Answers (5)

Answers (5)

Former Member
0 Kudos

Map the following. 

1) Header --- Header

2) Use    useOneAsMany and pass the following three parameters given below..

Serial No 
Item                ------useOneAsMany ---- Doc_Number
ItemNumber

3) Item --- Item
former_member187587
Contributor
0 Kudos

Glad you made it.

Make sure to test it with various messages to be stable for PROD.

Glad I could help.

Nimrod.G

former_member187587
Contributor
0 Kudos

Sorry for that. it was not that clear from your post.

I think using the Change context and the function UseOneAsMany might work for you cause this is a quit an easy task after all.

right click on the <Serial_Number> in the source Headr in the mapping.

change context into Header level.

Now map it to the <Doc_Number> in a context change of <Item>.

This will result in the source Queue - all the Serial numbers under the headr with context for each header.

i nthe function UseOneAsMany map the <Serial_Number> from the top headr and try

to duplicate it usign the number of items in the source message.

map the resukt to the target contecxt (might work even without splitByValue)

make sure that <Serial_Number> is a mandatory field becaue in case on empty XML tag the mapping wuill fail.

Good luck again.

Former Member
0 Kudos

Thanks for help.

But in the fuction UseOneAsMany I need to input three values. One - Serial_Number and what about the other 2?

I tried to transfer empy constants, it didn't help

former_member187587
Contributor
0 Kudos

use CopyValue from the Serial_Number for each Doc_Number.

This will work.

Former Member
0 Kudos

I tried this also it work's only if there is one <Header> node.

If I have a few Headers it copies the first Serial_number to all others.

Edited by: LOS' on Nov 30, 2008 3:47 PM

former_member187587
Contributor
0 Kudos

use Context change or splitByValue.

Former Member
0 Kudos

Hi Nimrod!

I tried to use SplitByValue but it did'nt help.

I insert SplitByValue function in my mapping and choose Each Value, that's what you mean ?