Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tFileOutput dynamically filename

Hello everyone,
i am stuck within a simple? problem.
If have a small process to extract data from a big xml file and save the output it in several small files.
the filename of each output file is dependent of the actual data.
example inputfile:
<PLANT>
<COMMON>Bloodroot</COMMON>
</PLANT>
<PLANT>
<COMMON>Columbine</COMMON>
</PLANT>
output files:
bloodroot.xml
columbine.xml
I extract the 'common' property into the context variable : context.FILENAME
But at execution time i only get one file: null.xml
How can i dynamically set the filename of the tfileoutput component?
Thanks your help
Michael
Labels (3)
4 Replies
Anonymous
Not applicable
Author

Does nobody have a tip or workaround for that?
Anonymous
Not applicable
Author

You are using correct file name but I think context variable are not initialized with proper values
You are using two context variables context.OUTPUTPATH, context.FILENAME
Try displaying data contained in 'common' property and context variables
Also select check box Append in tFileOutputDelimited so exisiting files are appended
alevy
Specialist
Specialist

The output file is initialised before the flow starts i.e. before the input file is even opened so you can't use values from the input for the output file name. There are other posts about how to achieve this e.g. https://community.talend.com/t5/Design-and-Development/spliting-files-an-renaming-files/td-p/72252.
Anonymous
Not applicable
Author

The output file is initialised before the flow starts i.e. before the input file is even opened so you can't use values from the input for the output file name.

Thats correct!
I used this approach:
Write the data to tempfiles and at the end rename your files to the appropiate name.