XML Header and Detail record

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ajmore
Participant
Posts: 22
Joined: Fri Aug 25, 2006 5:25 am

XML Header and Detail record

Post by ajmore »

Hi,

For the following xml as source file, i need to import data in dataset.

<IDOC>
- <ZCOMMHDR>
<ZCOMPANY>8206</ZCOMPANY>
</ZCOMMHDR>
- <ZCOMMDET>
<ZARTICLE>T816028NY00100</ZARTICLE>
</ZCOMMDET>
- <ZCOMMHDR>
<ZCOMPANY>8293</ZCOMPANY>
</ZCOMMHDR>
- <ZCOMMDET>
<ZARTICLE>T816028NY0E0200</ZARTICLE>
</ZCOMMDET>
- <ZCOMMDET>
<ZARTICLE>T313193VE0233</ZARTICLE>
</ZCOMMDET>
</IDOC>


Data should come the following format

<ZCOMPANY>;<ZARTICLE>

1st record : 8206;T816028NY00100
2nd record : 8293;T816028NY0E0200
3rd record : 8293;T313193VE0233

When i marked <ZARTICLE> {lowest element} as key field, i get 3 records as output, but as seen below it is not the required output.

1st record : 8206;T816028NY00100
2nd record : 8206;T816028NY0E0200
3rd reocrd : 8206;T313193VE0233

Can anyone please let me know any workaround for this issue?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post your XPath Expressions.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

The retrieval that you see is correct. Article, as a part of ZCOMMDET is an entirely separate repeating group from anything in ZCOMMHDR. They may "look" like a parent child relationship, but they are not.... to get the results you are looking for, ZCOMMHDR would have to be entirely wrapping the ZCOMMDET element. In this document they are equal. Without resorting to changes in xpath, you could just have two links, and then a counter to match them up later.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply