Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
MattE
Creator II
Creator II

Split to multiple files based on field

Hi,

I've got a redshift query which brings back some data, i want to split this data into multiple output csvs dynamically based on a field (company name). I know i could do this with the filter in tMap but that would require me to setup a filter per company beforehand and add / remove them each time which is no good. Is there another way to do this?

Any help would be appreciated.

Thanks

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

Iterate each record and set a dynamic output file, each output file only contains the data belong to the company name. eg:

tRedshitInput--main(row1)--tFlowIterate--iterate--tFixedFlowInput--main--tFileOutputDelimited

tFixedFlowInput: generate the current row.

set a dynamic output file path on tFileOutputDelimited:

"d:/file/"+ (String)globalMap.get("row1.companyNameColumn")+".csv"

 

Regards

Shong

View solution in original post

2 Replies
Anonymous
Not applicable

Hi

Iterate each record and set a dynamic output file, each output file only contains the data belong to the company name. eg:

tRedshitInput--main(row1)--tFlowIterate--iterate--tFixedFlowInput--main--tFileOutputDelimited

tFixedFlowInput: generate the current row.

set a dynamic output file path on tFileOutputDelimited:

"d:/file/"+ (String)globalMap.get("row1.companyNameColumn")+".csv"

 

Regards

Shong

MattE
Creator II
Creator II
Author

Thanks @Shicong Hong​ this is perfect