globalMap returns null at tAdvancedFileOutputXml file name

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
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.


All Replies
Forteen Stars

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.
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.

Eleven 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!

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.

Eleven 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!

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.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch