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

How to use input_row.Name to set for each row a new fileName output?

I read rows from a data source1. (schema DS1.Name, DS1.data, ...)
I wish to change fileName output with DS1.Name value. How can I do it?.
DS1 -> FileOutDS1.Name
a tJavaRow component enables to get/set a new context var value. but if this var is used in the fileName settings of the output file, it is first set to null (initial context val) and the new context value is not refreshed before the subjob execution ends (data source1 reading).
Labels (3)
12 Replies
Anonymous
Not applicable
Author

Hi,
to get a new filename for each row you need a new iteration. You could use tFlowToIteration and then initialize the file output component with the filename you get from your flow. To set the filename you should use the following code:
(String)globalMap.get("DS1.Name")

.
DS1 should be the name of the flow, name the name of the attribute.
Bye
Volker
Anonymous
Not applicable
Author

Hi,
with the flowToIterate component we can set globalMap var but it is not possible to set the FileName output with this globalMap var.
It seems that the fileName is set before iteration flow starts!
The first fileName value is null, the second file name gets the first value...
the tJava component is only used for iterate purpose or custom code. //globalMap.put("XMLFileName", row3.Name);
tJavaRow: globalMap.put("XMLFileName", row3.Name);
output_row.XMLTexte = ...;
fileOutput: "C:/..."+ (String)globalMap.get("XMLFileName")+".xml"
thanks in advance for your help.
Kind regards,
jn
Anonymous
Not applicable
Author

Maybe you shall change your jobb like this:
GP2_PROJET---row1--->tlogRow
\
--iterate-->tfileOutputdelimited with (String)globalMap.get("row1.Name") as filename
Anonymous
Not applicable
Author

that doesn't work.
Any other idea to set fileName dynamically while flow iterates?
Anonymous
Not applicable
Author

Which version of TOS do you use? I'll try to create a example.
Anonymous
Not applicable
Author

Hi,
I'm using TOS 2.4.1, but I can upgrade to TOS 3.0 if needed.
Thanks for your help.
Anonymous
Not applicable
Author

try using this
GP2_PROJET---row1--->tlogRow
\
--iterate-->tfileOutputdelimited with row1.Name as filename
Anonymous
Not applicable
Author

Hi,
the designer does'nt allow to put an iterate link between my dataSource (Database Table or Excel File) and the tFileOutPutDelimited. I can only use the "main" link: row. It seems OK as the each row of the dataSource will be processed with this link.
The iterate link can be put with the tFlowIterate component as shown on the picture enclosed first, but the outputFileName is set before the iterate link starts. As a consequence, the first fileName value is set the initial value(null); just before iteration starts!
Anonymous
Not applicable
Author

Let me show you what I did:
- DataflowKO_FileNameOK_0.1
- DataFlowOk_FileNameKO_0.1
either I managed to get fileName from Datasource but no data in the flow or I get data but not the fileName set from dataSource.

Could you explain me why and tell me more about the way I can get both?