Reading variables in tsendmail.

One Star

Reading variables in tsendmail.

Hi,

I have a child job that im counting the number of rows in a file, passing it to tSetGlobalVar and calling them like this:
((Integer)globalMap.get("Loaded"))

in the body to tSendMail and this works fine.

However, I want to move the tsendMail to my parent job and I begun with connecting tSetGlobalVar to tBufferOutput so the value would be available. In my parent job I made sure this works by adding a tJavaRow and putting the text:
System.out.println("The total number of rows is:"+input_row.Loaded) and I can see the value.

My problem is, I cant see how to call this in my tsendMail component.
Ive tried a few different ways e.g.
((Integer)globalMap.get(input_row.Loaded))
((Integer)globalMap.get("Loaded"))

I keep getting NULL Pointer exceptions.

Any help on how I can call this in the tSendMail would be appreciated.

Thanks,
Adrian
One Star

Re: Reading variables in tsendmail.

You could try using "row51.Loaded" in the tSendmail component like this:
tRunJob --> row51 --> tSendmail
Another possibility would be tostore the value which was returned from tRunJob (input_row.Loaded) using tSetGlobalVar or similar. This should make the value available outside of the tRunJob subjob.
Moderator

Re: Reading variables in tsendmail.

Hi,

Please take a look at a KB article about TalendHelpCenter:Returning a value from a child Job to the parent Job.

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: Reading variables in tsendmail.

I take out the pain of accessing and manipulating lots of text in the tSendMail by using a tJava upstream to hold the text of my email in a context variable and simply setting the value of the tSendMail Message to context.myEmailMessage...

So if you can print it, this should be able to work for you...
One Star

Re: Reading variables in tsendmail.

Thanks Willm, I will take a look at trying that.
Four Stars

Re: Reading variables in tsendmail.

You're welcome... Let us know if it works...
Four Stars

Re: Reading variables in tsendmail.

Hi
I have requirement where a child job is there and using a log catcher to catch the errors in child.
Then this job is being called in Parent Job and I did transmit whole context. In parent job also log  catcher is being used but it is giving error only as error in tRunJob_1 and also being sent in mail.

Is there a way to get the child error log  completely with all error messages which describes failure of child job completely and mailed via tsend mail.

I want to use tsendmail only in parent job as there will be multiple child jobs.
Moderator

Re: Reading variables in tsendmail.

Hi,
You may can return a value from a child Job to the parent Job.
Have you already checked KB article about:https://help.talend.com/search/all?query=Returning+a+value+from+a+child+Job+to+the+parent+Job to see if it can achieve your goal?
Best regards
S abrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Have you checked out Talend’s 2019 Summer release yet?

Find out about Talend's 2019 Summer release

Blog

Talend Summer 2019 – What’s New?

Talend continues to revolutionize how businesses leverage speed and manage scale

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog