Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

To pass child job result to a Parent job and send email based on the result

I've the context variable result in my child job and I would like to verify the result (Null/not null) in the parent Job and send email of the child job result in the body  if it is not null or continue with another tRunjob in the parent job.

My design looks like this:

1. I have passed the child job result in tBuffer output in my child job

2. My parent job 

0683p000009M73I.jpg

 tJavaRow

0683p000009M73J.jpg

tSendMail will have variable"var" in the message section

 

But the variable is not passing any data.

 

 

 

 

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

@Shree13 

 

Ideally both should give you same results. May be we will have to test with a simple sample job and verify the results.

 

Unfortunately I am in back to back meetings this afternoon and may not be able to check it. I would appreciate if you could mark the topic as resolved since my post helped to close your issue.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

View solution in original post

6 Replies
Anonymous
Not applicable
Author

While I tried if((String)globalMap.get("var") == null) System.out.println("test"); in tJava [ Instead of tlogRow in the above screenshot] which gives the output as "test" .
The same condition in RunIf condition to tSendMail

                     "(String)globalMap.get("var") == null"

is giving me false.
Why is the Runif condition not succeeding for the same condition in tJava?

 

Anonymous
Not applicable
Author

Hi,

 

    Below link will provide a sample scenario about how to send the data back to parent job.

 

https://help.talend.com/reader/jomWd_GKqAmTZviwG_oxHQ/q0zMmIuFx3zpGzwX0QE5Gw

 

    I assume that you are getting data back in parent job and your issue is related to null handling of the data.

 

     I would recommend to use the relational function below to do the comparison of null

 

Relational.ISNULL(row1.input_data)? "Null match condition passed": "Null match condition failed"

 for Run if condition, you can use Relational.ISNULL(row1.input_data) directly which will bring either true or false.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Anonymous
Not applicable
Author

Thanks, Nikhil for your response.
The problem is only in Runif part. I tried using Relational.ISNULL(row1.input_data) directly as suggested but it didn't work.
Job Design:
0683p000009M76q.jpg

 

tJava : if((String)globalMap.get("var") == null) System.out.println("test");
Runif ( To tSendMail) : Relational.ISNULL((String)globalMap.get("var"))
Run Job Log: 

                      [statistics] connecting to socket on port 3504
                      [statistics] connected
                      test

                      [statistics] disconnected

My tJava is giving "test" result which means it satisfies the condition (String)globalMap.get("var") == null  but the same is not working in RUNIF .

Anonymous
Not applicable
Author

Hi,

 

    Its working fine for me in both conditions.

0683p000009M6x6.png

0683p000009M76v.png

 

0683p000009M770.png

 

0683p000009M6zb.png

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

 

Anonymous
Not applicable
Author

 I think I figured out the issue. Used context variable instead of globalMap.put/get and it is working fine.

The reason is because of using variable globalMap.put("var",input_row.data); inside tJavarow  and getting the result as (String)globalMap.get("var") in RUNIF instead of creating a context as used in your case.

But why does it give a different result for a context variable and globalMap variable




Anonymous
Not applicable
Author

@Shree13 

 

Ideally both should give you same results. May be we will have to test with a simple sample job and verify the results.

 

Unfortunately I am in back to back meetings this afternoon and may not be able to check it. I would appreciate if you could mark the topic as resolved since my post helped to close your issue.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved