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

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.
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

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

APIs for Dummies

View this on-demand webinar about APIs....

Watch Now