One Star

How to use fields of input file in output file name?

Hi:
I imported a text file to database, for example: field1, field2 and field3, and when I dealt the filed2 and export another text file, I need to use the field in output file name, for example: aafield2.txt.
How to do?
Any help would be greatly appreciated.
1 REPLY
Community Manager

Re: How to use fields of input file in output file name?

Hi
You need to iterate each row and set a dynamic file name. For example:
tFileInputDelimited--row1--tFlowToIterate--iterate--tFixedFlowInput--main--tFileOutputDelimited
on tFixedFlowInput: generate the current data flow, define the same fields as tFileInputDelimited, which you want to output, on the schema, for example: define two columns:field1, field2
column:value
field1Smiley SadString)globalMap.get("row1.field1")
field2Smiley SadString)globalMap.get("row1.field2")
on tFileOutputDelimited: define a dynamic file name, feg:
"D:/file/aa"+(String)globalMap.get("row1.field2")+".txt"
----------------------------------------------------------
Talend | Data Agility for Modern Business