Ok - I don't think what I am trying to do is terribly complex, but I have read all of the documentation and searched the forum for hours and am still unable to accomplish what I am trying to do. All of the examples are either too simple or a little different from my scenario (which I would think is fairly common).
I would like to output an XML document containing customer data, order data, and phone number data. The relationship is like this:
1. The document can contain many customers.
2. Each customer can have many orders.
3. Each customer can have many phone numbers.
A sample file of my desired output is attached.
My input contains data from 3 different sources which are being joined together in the Map:
Customers:
ID First Last Primary Phone 1 John Smith 888-555-1212
2 Jane Smith 888-555-1212
3 Bob Evans 444-555-8888
4 Gina Evans 444-555-8888
5 Sallie Mae 111-222-3333
6 John Cueto 888-555-1212
Phone Numbers:
ID Sort Type Phone Number 1 1 HOME 800-555-1212
1 2 WORK 800-555-1212
1 3 MOBILE 800-555-1212
1 4 FAX 800-555-1212
2 1 HOME 800-555-1212
2 2 WORK 800-555-1212
2 3 MOBILE 800-555-1212
3 1 HOME 800-555-1212
3 2 WORK 800-555-1212
3 3 MOBILE 800-555-1212
3 4 FAX 800-555-1212
4 1 HOME 800-555-1212
4 2 WORK 800-555-1212
5 1 HOME 800-555-1212
5 2 WORK 800-555-1212
5 3 MOBILE 800-555-1212
5 4 FAX 800-555-1212
5 5 OTHER 800-555-1212
Orders:
ID Seq. OrderNumber OrderDate 1 1234 ORDER1234 9/29/2014
1 1235 ORDER1235 9/29/2014
1 1236 ORDER1236 9/28/2014
1 1237 ORDER1237 9/27/2014
2 1238 ORDER1238 9/26/2014
2 1239 ORDER1239 9/25/2014
2 1240 ORDER1240 9/24/2014
3 1241 ORDER1241 9/23/2014
3 1242 ORDER1242 9/22/2014
3 1243 ORDER1243 9/21/2014
3 1244 ORDER1244 9/20/2014
4 1245 ORDER1245 9/19/2014
4 1246 ORDER1246 9/18/2014
5 1247 ORDER1247 9/17/2014
5 1248 ORDER1248 9/16/2014
5 1249 ORDER1249 9/15/2014
5 1250 ORDER1250 9/14/2014
5 1251 ORDER1251 9/13/2014
I am trying to join these 3 in the tXMLMap, and getting various results - none of which match.
I have been trying to set orders and contact_methods as loop elements (2 loop elements), but when I do that I lose the ability to group.
Can anyone explain to me how to set up this tXMLMap to output the desired format? All of the examples I can find which contain multiple loop elements are for outputting non-hierarchical data (i.e. manufacturers and orders, but not related in a hierarchy). I can't find any examples which show how to output data like the attached file - where there is a hierarchy, and the multiple loop elements occur within a sub-element.
Hi rhall.2.0: No I am working directly with json and do not need in my current projects xml at all.
So the native json processing is exactly what I need.
The tXMLMap supports multiple loops but it is impossible to loop inside a loop multiple times.
Actually it would not be a big deal but Talend joins all input flows to one flow and do not use the input flows separately.
Hi jlolling
I am using dat component as u specified for generating complex json
But I have a problem in generating json with structure of array object inside array object for example
{"response": {"code": "00","status": "OK","content": {"Students": },{"sid": "3","name": "C","Marks": },{"sid": "4","name": "D","Marks": {"marks": "56","sub": "cs"}},"error": ""}}
I want such structure of json
please suggest some method with that component for this structure
thanks in advance