Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am new to Talend and couldn't figure out the solution to my issue on the forum.
I have a job which is something like:
toracleInput -> txmlmap -> trestclient
In txmlmap, I have generated an output in the form of JSON/XML which is attached below with the name of "output_for_API".
For now, its generating a consolidated file like :
<root>
<row>
<body><StockUpdate><locationDetail><location>0102</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>366715</gtin><quantity>1</quantity><exclude>false</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0645</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>27330</gtin><quantity>2</quantity><exclude>true</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0128</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>27330</gtin><quantity>-1</quantity><exclude>false</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0011</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>91552</gtin><quantity>0</quantity><exclude>true</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0645</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>483067</gtin><quantity>1</quantity><exclude>true</exclude></quantity_list></StockUpdate></body>
</row>
<row>
but I need a file per location to feed the API;Not a consolidated file
something like:
<StockUpdate><locationDetail><location>0102</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>366715</gtin><quantity>1</quantity><exclude>false</exclude></quantity_list></StockUpdate>
Any suggestions, how to split the output to get a file per location?
Thanks
Hi,
If you are doing Iterate instead of row link from tOracleinput, you will get one record at a time in XML format.
Please be mindful of performance since you are processing one record at a time.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Thanks for your response.
But I think, I couldn't make my point clear. I have a job attached below. I am getting an output which is something like:
<row>
<body><StockUpdate><locationDetail><location>0102</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>615</gtin><quantity>1</quantity><exclude>false</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0102</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>2330</gtin><quantity>2</quantity><exclude>true</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0778</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>2730</gtin><quantity>-1</quantity><exclude>false</exclude></quantity_list></StockUpdate></body>
</row>
<row>
<body><StockUpdate><locationDetail><location>0102</location><event_time>2019-07-04</event_time></locationDetail><quantity_list><gtin>9552</gtin><quantity>1</quantity><exclude>true</exclude></quantity_list></StockUpdate></body>
</row>
<row>
Now, I have two issues. Firstly, for each location (e.g <location>0102 ) I need quantity_list to be an object which contains (gtin, quantity and exclude) as its members.
(one location should appear only once)
So, the required format is:
2ndly, after getting output like above, how to send a file per store, not a consolidated file?
In the attached job, output_for_API in txmlmap is going to the tfileoutputDelimited, but it's just for testing. In actual, data will be going to the API.
Thanks for any help.
Ok. Please share 5 input records in exactly same way as in your input source.
Also please share the expected output data exactly in the same way as in the output flow. Then I can give it a try to reverse engineer the flow using Talend Data Mapper or using JSON components of Talend.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hi,
I have attached the input records. In txml Map, I have created an output with the name of out_for_API. Below is the expected output data:
{
"location": "",
"event_time": "2019-07-04",
"extern_ref": "",
"quantity_list": [{
"gtin": "02417403362921",
"quantity": 1
},
{
"gtin": "02417401093926",
"quantity": 2
},
{
"gtin": "02417403266526",
"quantity": 5
}]
}
Hi,
Can I please get the response for my query?
It will be of great help.
Thanks