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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Dynamic filename in tFileOutputDelimited component

Hi,
I need help trying to dynamically specify the name of the file to create in tFileOutputDelimited. I have attached some images showing a simplified job:
tFileInputDelimited --> tMap --> tFileOutputDelimited
When I use the value of a field that's flowing into tMap (row1.fileName), I get only null value for the variable. So, in my example, when the contents of the input file is
file1,content1
file2,content2
I get the output filename as <full path>dynamicFileNamingOutputnull.txt. I expected to get two files:
dynamicFileNamingOutputfile1.txt, and
dynamicFileNamingOutputfile2.txt
Any help will be greatly appreciated.
Thanks,
Yuan
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

ok - I figured out why I was getting a single line. I didn't check the "append" option in tFileOutputDelimited.
I'm all set.
Thanks,
Yuan

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hello
You should use tFlowToIterate+tFixedFlowInput to iterate each row, your job looks like:
tFileInputDelimited--row1---tFlowToIterate--iterate---tFixedFlowInput--main--tMap--tFileOutputDelimited
On tFixedFlowInput, generate one row of input flow, eg: define two fields on the schema: filename and content
set the value of filename column as: (String)globalMap.get("row1.filename")
set the value of content column as: (String)globalMap.get("row1.content")
on tFileOutputDelimited, set dynamically the file name like:
"D:/file/"+(String)globalMap.get("row1.filename")+".txt"
About usage of tFlowToIterate component, see 5827.
Best regards
shong
Anonymous
Not applicable
Author

Thanks Shong for the quick response.
I did revise the flow as you suggested. However, I'm only getting a single (last) line of output when there are supposed to be multiple lines.
Input:
file1,content1_1
file1,content1_2
file1,content1_3
file2,content2_1
file2,content2_2
I expected to see
file1
content1_1
content1_2
content1_3
file2
content2_1
content2_2
However, I'm getting
file1
content1_3
file2
content2_2
It appears the Number of lines in tFixedFlowInput is the culprit. Am I missing something?
Thanks,
Yuan
Anonymous
Not applicable
Author

I also tried using the tRowGenerator and the result is the same - only a single line (from the last row) is output in each file.
I expected it to generate a row for each incoming row. What am I missing?
Thanks for your help,
Yuan
Anonymous
Not applicable
Author

ok - I figured out why I was getting a single line. I didn't check the "append" option in tFileOutputDelimited.
I'm all set.
Thanks,
Yuan
bhagyarekha
Creator II
Creator II

Hi shong

@shong 

the same iam trying in my job but at creation of my filename dynamically, it is appending zero at last

pfscreenshot

output filename should be

dfsdmay161

but am getting

dfsdmay1610

Regards

rekha

 


Capture2.JPG
Capture.JPG
Anonymous
Not applicable
Author

Hi @bhagyarekha,

 

Please uncheck the split output file in several files in advanced settings in tFileOutputDelimited component.