Tuesday, October 27, 2009

Send Pentaho Report By Email

Send Pentaho Report By Email

The Pentaho Report Designer 3.5 brought along some important improvements. If you set up Xactions before that sent out reports by email, there are some slight changes now that you want to be aware of.

In my case I prepared a report that uses a MDX query as source, which automatically selects the last 5 days of data. The report doesn't use an input, so it is fairly easy to integrate into an Xaction.

My idea is to have basically a simplified version of the report in the email body and the full report with a chart as attachment. For the report, that I intend to have in the email body, I have to make sure that the CSS is not an external file. You can do this by going to File/Configururation in the Report Designer 3.5 and setting InlineStyle to true in output-table-html.

I set up following steps in the Xaction (Pentaho Report Designer 3.5):
  • Message template for email subject name. Define an output name.
  • Message template for file attachment name. Define an output name.
  • Message template for email text. Define an output name.
  • Pentaho Report XLS: In this step we create the Excel file for the attachment. Tag "Use Content Repository". Define "Report XLS" as output-name. Make sure you set the output-format to application/vnd.ms-excel
  • Pentaho Report HTML: Set to output-format to text/html. Tag "Use Content Repository". We will use this output for the email html body. Define "Report-HTML" as output-name.
  • Now drag and drop both Report-HTML and Report-XLS into the output folder in the report-outputs area. For each of them, add a output destination. At this point it doesn't matter which destination you choose.
  • Now we have to edit the XML directly, hence change to the XML view. Look for the outputs that you defined earlier, and if you defined i.e. a file destination beforehand, then replace the <file></file> by <contentrepo></contentrepo>.
  • Now add the email step. Fill out the fields and reference the parameters that we define earlier on where applicable. In example: Add a parameter to HTML message: "Report-HTML".


6 comments:

  1. I used this to setup my report email and it worked great....unfortunately images aren't showing up in the message. Do I need to setup a content repository to serve this data?

    ReplyDelete
  2. THANK YOU! I'd been trying to solve this problem for days. This post was a life saver.

    ReplyDelete
  3. can u share the report which u have created for the mail, so that we can implement in our scenario

    ReplyDelete
    Replies
    1. This is a very old article and I don't have these files any more. In any case, these days you should use PDI for this process.

      Delete
  4. can you tell me the process please it vl be help full for us..
    Thanks in advance

    ReplyDelete
    Replies
    1. I wrote once a blog post about it ... try to search in the archive.

      Delete