Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
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
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.
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):
Here are the tFileOutputDelimited settings:
And the content for the 2nd generated file:
2;f2.txt
Hope this helps.
no i need
aventure.jpn
fortu.jpn
brid.png
etc...
ok i try
Thank you so much, God Bless you
ça marche