Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to pass data to ta

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 

 

 

 

 

Labels (4)
5 Replies
Anonymous
Not applicable
Author

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 🙂

Anonymous
Not applicable
Author

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:

  1. {
    "location": "",
    "event_time": "2019-07-04T18:15:00+01:00",
    "quantity_list": [{
    "gtin": "615",
    "quantity": 1
    },
    {
    "gtin": "2330",
    "quantity": 2
    },
    {
    "gtin": "9552",
    "quantity": 1
    }]
    }

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.

 

Anonymous
Not applicable
Author

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 🙂

Anonymous
Not applicable
Author

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
}]
}

 

 

 


Input_flow_1.PNG
Input_flow_2.PNG
job.PNG
output_flow.PNG
output_for_API.PNG
Anonymous
Not applicable
Author

Hi,

 

Can I please get the response for my query?

 

It will be of great help.

 

Thanks