cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Mapping Deep Structure to Flat Structure

Former Member
0 Kudos

Hello,

I hope someone can help me. My scenario is idoc to file. I am collecting many idocs with a bpm and writing them out to one file. My bpm is working great, but my mapping program is not working properly. My source message is a deep structure and my target message is a flat structure.

See my example message formats below.

Source message:

zmessage (1..1)

+zidocmessage (0..unbounded)

++zidoc (1..1)

+++zidocheader (1..1)

++++zidocitem (0..unbounded)

Target Message:

zmessage (1..1)

+zfilemessage (1..1)

++zfilefirstrec (1..1)

++zfileheader (1..unbounded)

++zfileitem (1..unbounded)

I need to map zidocheader to zfileheader and zidocitem to zfileitem.

The Source Data:

<zmessage>

<zidocmessage>

<zidoc>

<zidocheader>

<hfield1>hf1</hfield1>

<hfield2>hf2</hfield2>

<zidocitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zidocitem>

<zidocitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zidocitem>

</zidocheader>

</idoc>

<zidocmessage>

<zidoc>

<zidocheader>

<hfield1>hf1</hfield1>

<hfield2>hf2</hfield2>

<zidocitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zidocitem>

<zidocitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zidocitem>

</zidocheader>

</idoc>

</zmessage>

The Target Data:

<zmessage>

<zfilemessage>

<zfilefirstrec>

<firstrecfield1>ff1</firstrecfield1>

<firstrecfield2>ff2</firstrecfield2>

</zfilefirstrec>

<zfileheader>

<hfield1>hf1</hfield1>

<hfield2>hf2</hfield2>

</zfileheader>

<zfileitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zfileitem>

<zfileitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zfileitem>

<zfileheader>

<hfield1>hf1</hfield1>

<hfield2>hf2</hfield2>

</zfileheader>

<zfileitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zfileitem>

<zfileitem>

<ifield1>if1</ifield1>

<ifield2>if2</ifield2>

</zfileitem>

<zfilemessage>

</zmessage>

Can someone advise me on how to map this correctly?

Thank you,

Rhonda

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

zidocheader -> use useOneAsMany node function to copy the header to create pair with zidocitem

give a try..

Former Member
0 Kudos

Hello Anand,

Would you mind giving me a mapping example you are referring to using the useOneAsMany node function? I am not sure how to use it with my example.

Thank you,

Rhonda

Former Member
0 Kudos

Hello,

Can someone please help me with this problem?

I am at the point where all of the records in my source message are being written out, however, all of the header records are together and all of the line item records are together. So, the target message is not in the proper sequence. It should contain the header record, then item records, header record, then item records, etc.

Is there anyone that can help me with this issue?

Thank you,

Rhonda

Former Member
0 Kudos

This has now been resolved!

I had to reformat my target message.

Thanks,

Rhonda

Former Member
0 Kudos

Hi Rhonda

I have exactly the problem that you have explained: I have a hierarchical xml file that I need to convert to a flat xml file. How did you manage to solve the problem?

Regards

Philip