Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Jasper report outputs as email attachments (tJasperReportExec)

Hi , 

 

I want send jasper report outputs as email attachments

 

I am using tjasperReportExec. The job looks as shown below. If I have to send the report output as an attachment to multiple email addresses, how do I do it? As of now it stores the output in a directory. Also, if I have 10 different email and the report output differs for each email, how do I pick the relevant attachment and send it in tsendmail component? 

 

0683p000009LyLA.png

 

Also what is the difference between tjasperoutputexec, tjasperreportexec and tjasperoutput?

 

Any ideas on this will be of great help

 

Thanks

Rathi

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi fdenis, I figured it out

 

I had to use ((String)globalMap.get("tJasperReportExec_1_OUTPUT_FILE")) this in the attachment section of tsendmail.

 

Now, I have another problem. The job runs fine on windows, when I run it on linux, I get the error 

 

java.lang.Exception: No Connection or JRDataSource available to fill the report

 

But, I have used to tmysqlconnection to populate the connection details

 

Any help on this please?

 

 

View solution in original post

22 Replies
aashish_21nov
Creator

for multiple Email you can use semicolon(0683p000009MA9p.png as a separator. Also to send different to differ user user you can use Trigger then runif strategy.

fdenis
Master

to send multiple reports, generate multiple report name using globalMap value of the tflowtoiterate.

Anonymous
Not applicable
Author

Hi Aashish,

 

I want it to loop, so I have used the tflowtoiterate. I want the report generated 10 times, each one containing the data specific for the email ID.

 

So, the relevant attachment needs to go to the correct email ID

 

My requirement is exactly the same as the solution in the video https://community.jaspersoft.com/blog/report-bursting-jasperreports-server

 

I read in a couple of articles that tjasperserverexec is not to be used as it is not updated regularly, hence using tjasperreportexec

 

Thanks

Rathi

Anonymous
Not applicable
Author

Hi fdenis,

 

Thanks, but, how do I attach it in the tsendmail? And how do I pick what is the relevant one for the specific email ID?

fdenis
Master

when you attache the document just add the output name of the report.

Define it unchecking "Use Default Output Name"

Fill Output name using distinct globalMap value as an email_id

Anonymous
Not applicable
Author

Hi fdenis,

 

In the attachment section of the tsendmail, I have used the code "C:/Users//report_out"+"_"+ ((Long)globalMap.get("row1.id"))+".xls"

 

And the tjasperreportexec has outputted these files already in the location mentioned above, report_out_1.xls, report_out_2.xls etc.

 

But I get the java.io.FileNotFoundException:  error.

 

I don't understand where is the error?

fdenis
Master

Users//report --> Users/report

Anonymous
Not applicable
Author

Apologies, that was a typing error. The code used is Users/report and I get the file not found exception

fdenis
Master

did you want one report by mail or multiple reports by mail?
You can try using a fix file first?