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).
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
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
Maybe you shall change your jobb like this:
GP2_PROJET---row1--->tlogRow
\
--iterate-->tfileOutputdelimited with (String)globalMap.get("row1.Name") as filename
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!
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?