Six Stars

how to generate dynamic csv file with a column data

From a table based on the data in a specific column I want to group the data and create a dynamic file
for example if a column called region have different regions data I want to generate the target file based on the region name in the region column.
region
--------
abc
xyz
def
so need three files with the respective data dynamically.could you please help with the required components need to be used as I am beginner for talend
3 REPLIES
Moderator

Re: how to generate dynamic csv file with a column data

Hi,
If I understand your requirement well, you are looking for a dynamic filename in tfileoutputdelimited component with table column name.
To make it clear, I have designed a demo job for you.
table:
id;place
1;a
2;b
There should be two .csv generated files a.csv and b.csv in folder.
Please see my screenshots for details
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: how to generate dynamic csv file with a column data

thanks for ur help ..but I am not able to figure it out with this solution as I need to group by the data and to write the particular group values in different files..
can u please help me how to define the tjava and use that value in the next flow to define the name
as I had given a sol
like
input-->tflowiterate-->tjava (one flow)
input -->output delimited(to use the name defined in the tjava)(second flow)
in the secnd flow while defining the filename when I search for tjava outputs I am nt getting the tjava component output..
can u please help me int his asap?
the best example could be I have employees in different departments..i want the files for each dept..
Five Stars

Re: how to generate dynamic csv file with a column data

you can design job your job like below.

your Input---tJavaRow----tFileOuputDelimited.
1. create variable for Group Name to hold the group name( context.GroupName)
2. in tjavaRow assign Group name to context variable like
context.GroupName=inputrow.groupName;

3. in tFileOutputDelimited components basic setting used context variable.
 "your filePath"+context.GroupName+"yourfileextention" 
like "c:/mydir/"+context.GroupName+".csv"

hope I explain well and it meets to your requirement.