globalMap returns null at tAdvancedFileOutputXml file name

Highlighted
Four Stars

globalMap returns null at tAdvancedFileOutputXml file name

Hello everyone.

I have an issue in TOS 5.4.

I need to create xml file according to field gathered from another xml. And I need to have dynamic file name of output file. But globalMap.get returns null in file name field.

I have checked that I have such value in globalMap by tJava element.

Please see screenshots.

 

Снимок1.PNG

Безымянный1.pngБезымянный2.png

Code in tJava_1

System.out.println("/Outbound/tokenRequestTemp/" +((String)globalMap.get("requestId"))+ ".xml");

I'm really stuck with that. Because I was using globalMap like this in another Output components and it was working fine.


Thanks in advance.

 


Accepted Solutions
Highlighted
Four Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

Ok, got it. Its time problem as Francois Denis said.
I have managed it through tRowGenerator

 

Безымянный3.png

 

Thank you Francois Denis.

View solution in original post


All Replies
Highlighted
Moderator

Re: globalMap returns null at tAdvancedFileOutputXml file name

@NikitaMikh,how are you putting global map value for 

requestId?
Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Highlighted
Four Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

Hello Manohar.

Yes in tJavaRow_1

globalMap.put("requestId", requestId);

And value is not null. I'm checking it in tJava_1 and output is correct.

Thirteen Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

requestId is a field?
so it row1.requestId

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Highlighted
Four Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

This is how I'm put requestId in globalMap in tJavaRow_1

String requestId = (String)globalMap.get("tWaitForFile_1_FILENAME");
requestId = requestId.substring(0, requestId.length() - 4);
requestId = requestId.replace(" ", "_");
globalMap.put("requestId", requestId);

No matter what I'm writing in file name: globalMap.get("requestId") or tokenRequest.requestId - output file name is still null.

Highlighted
Thirteen Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

ok sorry it's time problem.
xml file is open in write mode before calculation of the gblbalMap value.

Solution is:
tWaitForFile - iterate- tjava to set globalMap - onSubjobOk -
tFileInputXml…….

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Highlighted
Four Stars

Re: globalMap returns null at tAdvancedFileOutputXml file name

Ok, got it. Its time problem as Francois Denis said.
I have managed it through tRowGenerator

 

Безымянный3.png

 

Thank you Francois Denis.

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog