Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
My fault.
This design works:
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).
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?
Job currently looks like below;
Thanks
Hi @TRF
The tFlowToIterate is set to default, I've managed to get the fileName passing through row3 using below;
I can see it using trace debug, but when ALL of the files are created now, they are created as null.csv.
Any idea why it doesn't seem to want to use the value even though we can see it during trace debug?
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
My fault.
This design works:
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).