Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Creation of multiple output files from an input file

Hello
I need help. I am a beginner in Talend.
I have a file containing thousands of lines and for each line I have to create new files whose name is the same as my file line. Examples
Line1 = nomb.jpg
So in output I have to create the file nomb.jpg
Line2 = aventure.png
And aventure.png
Etc ...
Please help me.
I used the components tfileinputdelimited, tflowtoiterate, titeratetoflow e tfileoutputdelimited
But my files are not created.
Thank you

Labels (3)
23 Replies
TRF
Champion II
Champion II

So, it seems the field value on which you determine the output filename is always the same (aventure.jpg).
Right?
In this case, you may include the current iteration number into the output filename with this expression:  

"C:/Users/blablabla/ + (String)globalMap.get("Nom_Fichier").replaceAll(".jpg", "_" + ((Integer)globalMap.get("tFlowToIterate_1_CURRENT_ITERATION")) + ".jpg")

Expected result is:

aventure_1.jpg
aventure_2.jpg
Anonymous
Not applicable
Author

exemple:

file source file .csv

column with several lines:

line1= aventure.jpg

line2 = brave.jpe

line3= fortu.png

until

line N = butt.png

 

so on output, i want to build one file per line

exemple line1 becomes file1

file1 = Aventure.jpg

file2 = brave.jpe

file3 = fortu.png

until last line = butt.png

 

thank you so must for you help

TRF
Champion II
Champion II

Sorry, my mistake.

If you have let the tFlowToIterate component with default settings, the global variable name must include the row name. Change (String)globalMap.get("Nom_Fichier") to (String)globalMap.get("row1.Nom_Fichier").

Then, replace tIterateToFlow component by tFixedFlowInput to generate a new output flow for each iteration (tIterateToFlow will generate a single flow with as many rows as you have iterations from tFlowToIterate).

I have just tested and it works.

0683p000009MZvY.png

 

Here for the example, I want output file with rank number + filename, so here is the configuration for tFixedFlowInput_6 (forget tFixedFlowInput_5, it replace your input file): 

0683p000009MZvd.png

Here are the tFileOutputDelimited settings:

0683p000009MZt9.png

And the content for the 2nd generated file:

2;f2.txt

Hope this helps.

Anonymous
Not applicable
Author

no i need

aventure.jpn

fortu.jpn

brid.png

etc...

Anonymous
Not applicable
Author

ok i try

TRF
Champion II
Champion II

Continue in french please
Anonymous
Not applicable
Author

tFlowToIterate configuration look at my file join


tflowiterate.PNG
TRF
Champion II
Champion II

So you can continue to use the global variable "Nom_Fichier" but follow the given example.
Anonymous
Not applicable
Author

Thank you so much, God Bless you 

ça marche

 

TRF
Champion II
Champion II

Great!
Don't forget to mark your case as solved (Kudos also accepted).