insert table in email

Seven Stars

insert table in email

I want to send email though talend in which i want to insert a table. This table comes from data processing activity in which i join two mySQL tables and sort the data based on a column. How can i send this result in email body with a fixed salutation and signature?

 

I have read https://www.talendforge.org/forum/viewtopic.php?id=39657

and 

https://www.talendforge.org/forum/viewtopic.php?id=36026

however these examples are for sending results directly from DB without any processing. Below is what i have done so far.

Capture.JPG

Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

Hi,
Regarding your job, tSendMail is not connected with any other component, so it will start at the same time as tMysqlInput and for sure, will not give you the expected result.
So, connect these 2 components using trigger onSubjobOk.
Now, I suppose the result is built in tJavaRow using global variables.
So you just have to reuse these variables in tSendMail to get the expected message, perhaps using html for a friendly presentation.
If you have some difficult to get what you want, share details for each component configuration.

TRF
Seven Stars

Re: insert table in email

The only problem i am facing is that i can't see onSubJobOk option, rest i understand how to do. 

 

Capture.JPGCapture.JPG

Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

You need to connect the 1st component with onSubJobOk, you cannot connect an other one.


TRF
Seven Stars

Re: insert table in email

Where exactly is first component? tMysqlinput1, tMysqlinput2, tMap1, tSortrow1, tJavarow or tSendemail? I assume that you're talking about tSortrow1 and tJavarow. And again which component should be connected with which component as onsubjob1? and what connection type for second one?

Highlighted
Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

The 1st one is the green one, tMysqlInput in your case.


TRF
Seven Stars

Re: insert table in email

Now i can't connect between tMySqlInput1 and tMap1 through subjob. I even tried with tJoin and its not working either.

 

Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

Of course you cannot!

You just have to connect tMysqlInput_1 to tSendMail_1 using onSubjobOk to be sure tSendMail_1 will start after the variables you use to construct the email will be populated.

Also rearrange the job design, move tMysqlInput_2 on top of tMap_1, then move tSendMail_1 to the left (where is actually tMysqlInput_2).


TRF
Seven Stars

Re: insert table in email

Can you post a screenshot or flow chart?


@TRF wrote:

Of course you cannot!

You just have to connect tMysqlInput_1 to tSendMail_1 using onSubjobOk to be sure tSendMail_1 will start after the variables you use to construct the email will be populated.

Also rearrange the job design, move tMysqlInput_2 on top of tMap_1, then move tSendMail_1 to the left (where is actually tMysqlInput_2).



post a screenshot? or flow design?

Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

should look like this:

Capture.PNG

Sorry for the quick and dirty design!

 


TRF
Seven Stars

Re: insert table in email

Not sure why it isn't working. here is my revised workflow desgin

Capture.JPG

Here is tJavarow code.

Capture.JPG

 

 

Error message
Execution failed : Job compile errors 
At least job "test" has a compile errors, please fix and export again.
Error Line: 1457
Detail Message: Status cannot be resolved or is not a field
There may be some other errors caused by JVM compatibility. Make sure your JVM setup is similar to the studio.

 

 

Fifteen Stars TRF
Fifteen Stars

Re: insert table in email

Click on Code tab, check for errors in source code using red rectangle(s) on the right side

TRF
Ten Stars

Re: insert table in email


Detail Message: Status cannot be resolved or is not a field


This usually indicates a reference to a flow variable that's not defined.  Check the spelling/capitalization of the tMap output field you're referencing.

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch