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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tJava to tFileOutputDelimited returns null for initial value

Hi,

 

I have a job which parses a CSV output from an API. I am trying to dynamically set the file name, however, the first result of order number is always null, and then rest is 1 off.

 

The orderNumber shows correctly using System.out.println() in the tJava, so I'm assuming its something to do with the order that things are executed?

 

I have attached screenshots of both components & the workflow of the job.

 

Is there a way around this? I can't extract the order number directly from the JSON because its just a data object with csv inside of it.


Thanks

 

 

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

My fault.
This design works:

0683p000009M6oq.png

Fill in the fields in tJavaFlex and set filename using global variables from tFlowToIterate.

In my case I use (String)globalMap.get("row17.data").

tFixedFlowInput is there to replace your tExtractJSONFields (4 rows with 1 field each = 01, 02, 03, 04).

View solution in original post

21 Replies
TRF
Champion II
Champion II

Because tJava is the 1rst component fired when the subjob starts.
Replacing tJava by a tIterateToFlow should be enough to avoid null value for the filename.
Anonymous
Not applicable
Author

Thanks for the quick reply.

 

The tJava is responsible for using substring to get the filename. 

String orderString = row1.data.toString();
String orderNumber = orderString.substring(0, orderString.indexOf(','));

 

Is there a way to replicate this inside a tIterateToFlow? I tried below but it only returns null. Is this because of how I'm referencing row3.fileName in the tFileOutputDelimited or something else?

0683p000009M6ob.png

 

0683p000009M6QQ.png

 

 

TRF
Champion II
Champion II

Can you share the new job design?
Anonymous
Not applicable
Author

Job currently looks like below;

0683p000009M6Zn.png

 

Thanks

TRF
Champion II
Champion II

If you have used default for tFlowToIterate, try to replace row1.data by (String)globalMap.get("row1.data"). If you don't have used default, use your variable name instead of "row1.data" for the globalMap.get.
Anonymous
Not applicable
Author

Hi @TRF 

 

The tFlowToIterate is set to default, I've managed to get the fileName passing through row3 using below;

0683p000009M6og.png

I can see it using trace debug, but when ALL of the files are created now, they are created as null.csv.0683p000009M6ol.png

 

Any idea why it doesn't seem to want to use the value even though we can see it during trace debug?

TRF
Champion II
Champion II

Try to reuse (String)globalMap.get("row1.data") for the tFileOutputDelimited too
Anonymous
Not applicable
Author

if I put;

 

File Name: "C:/Users/user/Desktop/Ax_Orders/" + (String)globalMap.get("row1.data").toString().substring(0, globalMap.get("row1.data").toString().indexOf(',')) + ".csv"

 

inside of the tFileOutputDelimited then it just creates one CSV, with the name of 27.csv. Interestingly, it now seems to only be evaluating this once rather than once per row.

 

I need a CSV per row which was the original reason for trying to use tJava to handle the row & filename 0683p000009MPcz.png

 

TRF
Champion II
Champion II

My fault.
This design works:

0683p000009M6oq.png

Fill in the fields in tJavaFlex and set filename using global variables from tFlowToIterate.

In my case I use (String)globalMap.get("row17.data").

tFixedFlowInput is there to replace your tExtractJSONFields (4 rows with 1 field each = 01, 02, 03, 04).