Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a single CSV file with the following structure:
id_soc;code_soc;date;lieu;nb_clients
01;nj0120;120225;paris;25
02;nj0120;160523;nantes;10
03;jf2563;250426;leHavre;5
I want to split this CSV into multiple output CSV files, one per code_soc, with the following format (example for nj0120😞
code_soc;date;lieu;nb_clients
nj0120;120225;paris;25
nj0120;160523;nantes;10
I tried using a tFlowToIterate to loop over each code_soc and generate a file with a dynamic name like:
"fichier_" + code_soc + ".csv"
The files are created with the correct names, but they are empty.
What is the best way to split one CSV into multiple CSV files dynamically based on a column value, without having to manually create a filter for each value?
Thanks in advance!
This solution worked for me !
Thanks
Hello anyxs,
Thank you for reaching out to the Qlik community.
Best approach: use “Dynamic filename” in tFileOutputDelimited — no iterate needed.
Instead of tFlowToIterate, use tFileOutputDelimited with “Use dynamic filename” (or Expression in File Name) directly in the flow.
This will automatically:
tFlowToIterate is not meant for row-by-row file writing — it passes values via globalMap, and you lose row streaming → leads to empty outputs, and that is the reason why your method failed.
Hi Rahul,
Thank you for your answer,
So I tried :
- Left "Use output stream" UNCHECKED
- In the standard "File name" field, typed the String path: "C:/export/fichier_" + out1.code_soc + ".csv"
- Checked "Append"
- Checked "Include header"
But this does not work either — I get a fichier_null.csv in the right path with all the data from the source csv
My current flow is:
tFileInputDelimited → tMap (remove id_soc) → tFileOutputDelimited
Is there a specific update for the tFileOutputDelimited or another solution ?
Thanks
This solution worked for me !
Thanks
Hello anyxs,
You have marked the wrong comment as an accepted solution; the information that worked for you, you will need to mark as an accepted solution.