Skip to Content
0
Former Member
Dec 07, 2009 at 04:14 PM

Mapping problem - trying to map lowerlevel field to flat file

20 Views

Dear experts,

I have a rpoblem mapping my data.

my input-xml looks like this:

. orderheader

...orderdetail (1..n)

.....delivery header (1..n)

.......delivery detail (1..n)

.........invoice header (always max 1 per delivery detail)

...........invoice detail (always max 1 per invoiceheader)

.......delivery detail

etc

I have a flat file as output which looks like this

. RECORD

...ORDERNR

...ORDERPOSITION

...DELIVERYNUMBER

...DELIVERYPOSITION

...INVOICENUMBER

...INVOICEPOSITION

If there are 2 invoicelines in the input xml, the outputfile should contain 2 records with all same data except invoiceposition. For each delivery-detail line a line in the outputfile must be created. So I mapped "deliverydetail" to RECORD. No problems here.

Further I mapped invoicenumber (within the invoice header tag) to INVOICENUMBER.

But when for instance deliverydetail 1 and 2 don't have an invoice, and deliverydetail 3 does, I see this invoicenumber not in record 3 but in record 1. Record 2 and 3 contain no invoicenumber.

What am I doing wrong here?

Thanks in advance,

William