cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Mapping flat incoming documents to object output

daniel_stolsbot
New Contributor

Hi,

I have a csv file containing rows with customer orders which I want to map to an XML invoice object which generates an invoice containing all the customer orders.

The incoming data looks like this:

CustomerId Price Quantity
4 20 1
4 20 2
5 30 1
5 30 2

The target schema is an XML with the following structure:
InvoiceXMLtemplate

My desired outcome would be to loop through the incoming rows where customer id is e.g. 4, and write the two orders as InvoiceRow elements, within the โ€œinvoicesโ€ object, producing two documents as output looking like this:
expecteResult

My current pipeline looks like this and just maps the four flat incoming documents to four output documetns:
currentPipeline

Does anyone have any tips on how to acchieve this?

1 ACCEPTED SOLUTION

christwr
Contributor III

Welcome to the community Daniel!

Try a GroupByFields on CustomerId to create a document for each (InvoiceOrder), and then another generic GroupByN=0 to clump everything together into one document (Invoices) before converting to XML. Can also probably just convert as-is to XML, then use an XSLT to re-arrange/format as desired.

View solution in original post

2 REPLIES 2

christwr
Contributor III

Welcome to the community Daniel!

Try a GroupByFields on CustomerId to create a document for each (InvoiceOrder), and then another generic GroupByN=0 to clump everything together into one document (Invoices) before converting to XML. Can also probably just convert as-is to XML, then use an XSLT to re-arrange/format as desired.

Thank you for the swift reply! Got the correct formatting by using GroupByFileds followed by GroupByN as you described.