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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit4
Contributor III
Contributor III

Merge and Send Mail

Hi,

I created this job in which there are two tables Employee and Employee_INC. Employee table is my source table if any new record is inserted then only that particular record should be inserted for that I am separating old records and new inserted records using tmap. Then in flow meter I am reading the information and then catching the information using flow meter catcher then I am storing into log table tbdboutput2 after that I am sending mail for the action.

But I am getting two different mails one for new inserted records and other for old records separately.

0695b00000bEwR6AAK.png

How can I combine both and get both the data in single mail.

Thanks

Amit

Labels (6)
7 Replies
Anonymous
Not applicable

Hi

There are two tFlowMeter components in the job, each tFlowMeter will trigger tFlowMeterCatcher execution, that's why you receive two emails.

You can store the data into memory using tHashOutput, in the end of job, read the data from memory and send only one email.

eg..

tFlowMeterCatcher...tlogrow--tDBOutput--main--tHashOutput

 

tPostJob--oncomponentok--tHashInput--main--tSendMail

 

 

Regards

Shong

Amit4
Contributor III
Contributor III
Author

Hi Shong,

 

As per your instructions I did the same still I am getting two different mails.

Please have a look on it.

0695b00000bF5vyAAC.png 

Thanks

Amit

Anonymous
Not applicable

You'd have to aggregate your results (tAggregate* ) into 1 single row and send that to the mail.

 

You're triggering tSendMail twice

Amit4
Contributor III
Contributor III
Author

Hi,

 

So, I added that aggregate row component now, but I am getting null values in my mail.

 

0695b00000bF8xsAAC.png 

This is what I want to print in my mail.

 

------------------------------------------------------------------------------------

0695b00000bF90hAAC.png------------------------------------------------------------------------------------

 

Please have a look.

 

Thanks

Amit

Anonymous
Not applicable

What could be the value for Action? No of records=inserted records+old records?

 

 

Amit4
Contributor III
Contributor III
Author

In the first image it is clearly visible that 5 old records and 0 new Inserted records.

Action : Old Records

No of Records = 5

Action : Inserted

No of Records = 0

 

Anonymous
Not applicable

The requirement is clear now. To implement it, define a context variable let's call it message, string type. In the beginning job, initialize the value of the variable with execution time and job name on a tJava:

context.message="This is notification for the insertIncrmentalJob"+"\r\n"+"Time at Job execution: "+TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", TalendDate.getCurrentDate())+"\r\n"+"JobName: "+jobName;

 

Append the action and no of records value to the context variable on a tJavaRow after tFlowMeterCatcher.

tFlowMeterCatcher--tDBOutput--main--tJavaRow

 

on tJavaRow:

context.message=context.message+"\r\n"+"Action: "+input_row.label+"\r\n"+"No of records: "+input_row.count;

 

In the end of job, send an email using tSendMail, set the Message field with context variable context.message.

 

tPostJob--oncomponent--tSendMail

 

Hope it helps!

 

Regards

Shong