Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
BderPan
Contributor III
Contributor III

Unique Filename by a Value of an XML - Node

Hi, 

 

I create a Job which list XML -Files and now I want a unique Filename out of a Value of a Node from the XML. 
0683p000009LzNR.png

If I run this Job, the output for the first File ist NULL.xml and the Others are right and  the Content of the Files are in the next File not in the File which the Number has.
0683p000009LzNW.png
I use the tJavaRow for to set a Variable and to check is the Variable != null 

 

//own script for order_id
output_row.ORDER_ID = input_row.ORDER_ID;
if(output_row.ORDER_ID != null){
	globalMap.put("name", output_row.ORDER_ID);
	System.out.printf("Dies ist der Output: " + output_row.ORDER_ID);
}else{
	globalMap.put("name", "error");
};
//end

I think, if I run the job, the Variabale was set on runtime and is null a the first. How can I solve the Problem? 

Thanks for help. 

Greetings Chris 0683p000009MACJ.png

Labels (4)
5 Replies
TRF
Champion II
Champion II

Files are created each time a new iteration starts, so when the subjob starts, the tJavaRow has not been yet executed and the "name" variable is null.
Use tFlowToIterate then tIterateToFlow after tJavaRow to solve your case.
BderPan
Contributor III
Contributor III
Author

Hey TRF, 

thanks for the fast Help,

if I use tJavaRow -->tFlowToIterate-->tIterateToFlow-->tAdvancedFileOutputXML it creates only one File and write alle the content of the InputFiles in it.

 

0683p000009Lz4K.png

BderPan
Contributor III
Contributor III
Author

Has Nobody a solution for me 0683p000009MPcz.png 

Anonymous
Not applicable

Hi
Can you show an example of input XML file? How many nodes could be extracted from the input XML file?

Regards
Shong
BderPan
Contributor III
Contributor III
Author

Hi Shong, the nodes are variable in the input File. My first problem was that I can´t set a global Variable with content of a row. At the first iteration the unique file name which I use the global Variable was null and the Content was not in the correct file. So I use the solution of TRF, it generates one File with all the Content of the input files 0683p000009MPcz.png

Regards Chris