Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sending mails when certains contdition remains true

Hello reader,
I have specific use case scenario where i need to trigger a mail only when the desired contdition is being fulfilled

I have a redshift table with table name validation
and it has 3 columns with names
restaurant_id,order_time_mysql,order_time_redshift

what i am doing via query is comparing the time time between
where order_time_mysql=order_time_redshift
(if the result comes out to be null) ===> no actions required

(if the result comes out to be NOT NULL)===> trigger a mail to desired recipents

What i have accomplished till now is i have created a job which will trigger a mail irrescpective of result is null or not

"this is the restaurant_id:     "+context.restaurant_id+"    \n last updated entry for this restaurant in redshift was made on date:      "+context.order_date_redshift+" \n    last updated entry for this restaurant in mysql was made on date:     "+context.order_date_mysql

How do i apply the contidion login in the existing scenario
regards
Ankit Khanduri
0683p000009MFzF.png
0683p000009MFlV.png 0683p000009MFqB.png
Labels (3)
3 Replies
vapukov
Master II
Master II

You can use run-if trigger from Your tJavaRow component to the tMailSend
in tJavaRow depending from query result set variable v_send_mail =0/1
and trigger condition will be just check - is this variable == 1? You can create second trigger (as many as You need) and send different eMail if condition ==0 and etc
Anonymous
Not applicable
Author

thanks for the answer
But can u also share how to update tjava component and how to utilize run/if trigger
and also i don't want any mail to be trigger if ==0
I am new to talend so help will be really appreciated
regards
vapukov
Master II
Master II

I just show example with context for make type conversion more easy and shorter variables, but same with global variable:

- add context variable send_mail_if, type INT. You already have few - so this must be easy
in Your already presented tJavaRow:
at the begin insert row:

context.send_mail_if = 0;


after all Your rows insert next:
if (out2.order_date_redshift!=out2.order_date_mysql) {
    context.send_mail_if = 1;
}


delete connection between tJavaRow and tSendMail, and right click mouse choose run-if, connect it to tSendMail
then click mouse on this line and edit conditions

context.send_mail_if==1;



0683p000009MFzK.png   0683p000009MFzG.png