How to set multiple loop elements in tWriteJSONField

Four Stars

How to set multiple loop elements in tWriteJSONField

I am not able to set multiple as Loop Elements as i am getting multiple values from database in same same column for one particular id, so i want to generate json file and then want to insert to Mongodb.

Employee

Re: How to set multiple loop elements in tWriteJSONField

Hi,

 

   Could you please provide 5 or 6 sample records and its expected output in a sample file? Please also include your current output along with overall job and component screen shots. This will give us idea about how to analyse in detail.

 

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 :-)

Four Stars

Re: How to set multiple loop elements in tWriteJSONField

The input table :

 

Produit

Marque

Client

Année

A

Toyota

1

2018

B

Toyota

2

2019

C

Renault

3

2017

D

Toyota

4

2017

 

The json file to generate: 

{

  ‘Datas’ : [

             {Marque : ‘Toyota’, Produits : [A, B, D], Clients : [1,2,4], Année : [2017,2018,2019]},

             {Marque : ‘Renault, Produits : [C], Clients : [3], Année : [2017]}

  ]

}

 

The components of the job: Capture.PNG

 

I have used a tSortRow in order to sort the data on the field Marque and then used the tWriteJsonField in order to generate the json file, the problem is that i can't use multiple loop elements in order to group the data into different arrays.

Tags (1)
Eleven Stars

Re: How to set multiple loop elements in tWriteJSONField

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now