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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
timx0ne
Contributor
Contributor

One CSV file for each row with dynamic CSV file name

Hello,

 

I have a job which creates one CSV file from a SQL database. They are shipments details in order to provide datas to the carrier software.

Today all the rows from the database are included in the CSV file. The first column in my schema is the shipment id.

Now I need a new out which creates one CSV file for each row and the CSV file name must be the row value of the first column.

 

For the dynamic CSV file namee, I created a context variable in my job, and I affected this variable in the file name field of my new tFileOutputDelimited component, it works, I get the value of the context variable as the file name, but I don't know how I should do to set this context value during the job process, I think it must come from an iteration...

 

For the creation of the CSV file for each row, I tried to do that with tFlowToIterate, tIterateToFlow, TForeach... without success.

 

Can someone help me please ?

 

Best regards, Tim.

Labels (4)
1 Reply
gjeremy1617088143

Hi, @timx0ne,

you can use for example tFlowtoIterate ( check

Use the default (key, value) in global variables then uncheck it then check it again ---> all the variables created by the tFlowToIterate will appear in the outline view )

-->iterate link --> tRowgenerator with all the fields you want with value as the variables of the tFlowToIterate (and 1 as row number)

you have also access of the ship id for each iteration so you can construct your file name on the iteration.

you can acces the variables generated by tFlowToIterate just by typing the begining of them and press ctrl+space :

eg: if you send a field Ship_ID in the tFlowToIterate

type Shi then ctrl +space and the variable will appear in a dropdown list

Send me Love and kudos