Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I'm trying to set the filename of the tFileOutputDelimited with a variable, but this doesn't seem to work.
Goal is to read an excel, which has got one or multiple lines per customer_po_no and then split it into a file per customer_po_no.
Therefor I have this job:
In the tJavaRow_1 I do:
System.out.println("PO: " + input_row.CUSTOMER_PO_NO);
context.CUSTOMER_PO_NO = input_row.CUSTOMER_PO_NO;
and in tFileOutputDelimited_2 I set the filename as:
context.CUSTOMER_PO_NO + ".csv"
I see the number being printed is the correct one, however the filename is null (blank)
any ideas ?
thanks and kind regards
Christoph
Oh sorry, I missed that.
You could do something like this -
1) Use tFlowToIterate after tMap.
2) Then join tJava using iterate flow.
3) Set the values of input row fields for tFileOutDelimited in tJava like - row2.<fieldname> = ((String)globalMap.get("output.<fieldname>"));
4) And filename you can fetch using ((String)globalMap.get("output.customer_po_no")) in tFileOutputDelimited component.
Please refer the attached screenshot for better clarity.
Best Regards,
Abhishek
Hi Christoph,
I think what you should do, you should use here OnComponentOk trigger on tJavaRow instead of using main row.
I suppose what's happening here is main flow is getting executed before the value is set to the context variable customer_po_no.
Best Regards,
Abhishek
hi Abhishek
thanks for the tip, but the tFileOutput requires a row input instead of an OnComponentOK, how should I overcome that ?
regards
Christoph
Oh sorry, I missed that.
You could do something like this -
1) Use tFlowToIterate after tMap.
2) Then join tJava using iterate flow.
3) Set the values of input row fields for tFileOutDelimited in tJava like - row2.<fieldname> = ((String)globalMap.get("output.<fieldname>"));
4) And filename you can fetch using ((String)globalMap.get("output.customer_po_no")) in tFileOutputDelimited component.
Please refer the attached screenshot for better clarity.
Best Regards,
Abhishek
Thanks Abhishek, your tip got it working!
quite surprised though, I would expect that in a tJavaRow component, connected to the main row, the order of the execution should be sequential, and this would avoid the issue with the context variable not being filled in? where is my understanding wrong there, any idea ?
After constructing a Job with a Source and Target defined. If for any reason I need to delete the object(Source or Target) within the Job and bring it in again. I cannot name the Source or Target the same name given.... Seems like it stores it in memory but I cannot find where that is so I can remove it!?