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

Highlighted
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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog