COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: Nikhil Shenoy on 11 Jan 2018 02:37:20 AM

Title: Embed html report in Email body
Post by: Nikhil Shenoy on 11 Jan 2018 02:37:20 AM
Is it possible to embed data in the email body? When scheduling report as email output, we can set the report as attachment. We have a requirement to show a pivot as part of the email body.
I tried to use the steps mentioned in the following link, but still the mail is coming as an attachment & not in body
http://www-01.ibm.com/support/docview.wss?uid=swg21659766

Thank you.
Title: Re: Embed html report in Email body
Post by: Lynn on 11 Jan 2018 02:52:23 AM
Quote from: Nikhil Shenoy on 11 Jan 2018 02:37:20 AM
Is it possible to embed data in the email body? When scheduling report as email output, we can set the report as attachment. We have a requirement to show a pivot as part of the email body.
I tried to use the steps mentioned in the following link, but still the mail is coming as an attachment & not in body
http://www-01.ibm.com/support/docview.wss?uid=swg21659766

Thank you.

Is this the same question as your other post in the CA reporting board where you said you were using 11.0.6?: http://www.cognoise.com/index.php/topic,34130.msg112510.html#new

It should work the same in v10 as 11 so not sure why you are re-posting the question here?

Can you describe your steps so someone might understand where you went wrong? The report must be sent as HTML format in order to appear in the body of the email and the email body must be left blank when setting up the schedule. Can you get it to work with a simple report that only has one HTML page for the body and nothing as an attachment? A little more information from you would help you get better responses.
Title: Re: Embed html report in Email body
Post by: Nikhil Shenoy on 11 Jan 2018 03:03:05 AM
Sorry to re-post the question.
I tried it in simple report and it worked. The report in which I am trying to do this has total 2 pages:
1. Page for Mail Body
2. Summary sheet
3. Detailed line items

The first page should go as E-mail body and remaining 2 pages should go as an attachment in excel format.
Title: Re: Embed html report in Email body
Post by: Nikhil Shenoy on 11 Jan 2018 03:06:07 AM
How to use the render variable??
Can you help me out with that?
Title: Re: Embed html report in Email body
Post by: Lynn on 11 Jan 2018 07:00:46 AM
Quote from: Nikhil Shenoy on 11 Jan 2018 03:06:07 AM
How to use the render variable??
Can you help me out with that?

Go to the page level properties for your page that is for the email body and find the render variable. Open that property and select the "new boolean variable option from the variable drop down at the top. Call it "Render for HTML". The expression should use the ReportOutput() function which you can find on the function fx tab. This is the expression that will evaluate to TRUE when run option is HTML.


ReportOutput () = 'HTML'


This means the page will only render when the output format is HTML.

Create another boolean variable to render only when the output format is Excel and set this as the render variable on the other two pages:


ReportOutput () = 'SpreadsheetML'


Save the report and then run it in the background specifying BOTH HTML and Excel as the output format. Leave the email body blank.

When this runs it should include page 1 as the email body and attach the report as Excel including only pages 2 and 3.

Links below describe how to add a variable from the condition explorer in version 10 and other helpful articles. In 11 you'll find it in the second tab of the query pane. My above example is creating a variable "on the fly" from the render property. If you create it first from the condition explorer you'd simply select it as the one to use in the render property.

I tend to use Boolean variables but you could achieve the same thing with a string variable.

https://www.ibm.com/support/knowledgecenter/en/SSEP7J_10.2.1/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.2.1.doc/t_cr_rptstd_modrep_adding_variable.html

https://www.ibm.com/support/knowledgecenter/SSRL5J_1.0.1/com.ibm.swg.ba.cognos.ug_fm.10.1.1.doc/c_crx_reportoutput.html

https://www.ibm.com/support/knowledgecenter/en/SSMR4U_10.1.0/com.ibm.swg.ba.cognos.ug_cr_rptstd.10.1.0.doc/c_cr_rptstd_modrep_cond_rendering.html
Title: Re: Embed html report in Email body
Post by: Nikhil Shenoy on 12 Jan 2018 03:35:40 AM
Hey Lynn,

Thanks a lot for helping me achieve what was desired..!!!
Title: Re: Embed html report in Email body
Post by: Lynn on 12 Jan 2018 04:07:57 AM
Quote from: Nikhil Shenoy on 12 Jan 2018 03:35:40 AM
Hey Lynn,

Thanks a lot for helping me achieve what was desired..!!!

Glad you got it sorted out :)
Title: Re: Embed html report in Email body
Post by: charlie on 14 Dec 2018 01:52:55 AM
Hi All!

Has this stopped working in 11.0.10? I have done this sort of scheduling multiple times before and it never failed to work in older versions. But when i try to schedule a report to be delivered in HTML format as an attachment in 11.0.10 it gives me a html page as an attachment :(

Any thoughts? Thanks in advance!

Charlie
Title: Re: Embed html report in Email body
Post by: CognosPaul on 14 Dec 2018 09:14:34 AM
Make sure the email body is completely empty. There might be stray space in the email body.
Title: Re: Embed html report in Email body
Post by: charlie on 17 Dec 2018 05:40:17 AM
And there was! :) There was a stray space in mail body. Removed it and it works like a charm. I don't remember putting a space in the body though. Wonder how did it end up there ::)

Thanks Paul!