COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tkjenkin on 18 Apr 2016 02:30:29 PM

Title: Using one Button to run a Report and Send Report via email
Post by: tkjenkin on 18 Apr 2016 02:30:29 PM
I would like to know if anyone has ever combined running a report and sending a report to email with one button. 
To run the PDF I have this logic in one button.

<input type='Button' value="Open in PDF"  onclick="javascript:gCognosViewer.getRV().viewReport('PDF')">

Then I have this logic to send Report by Email

One Html

<script>
function emailPage()
{
   try   {window['oCV'+'_THIS_'].getRV().SendReport(false);}
   catch (err) {}
}
</script>

Second Html


<input type='Button' value = "Email Report"
onclick="emailPage()"
value="Email"
ACCESSKEY="e"
title="Keyboard shortcut: alt-e">

I have also tried using this logic to run the PDF.


<script>
CViewerManager.prototype.runPDF = function ()
{   var oReq = new ViewerDispatcherEntry(this.getCV());
  oReq.addFormField("ui.action","render");
  oReq.addFormField("run.outputFormat","PDF");
  this.viewPDFInNewWindow(oReq);
style = "background-color:#cc2d30;width: 155px;height: 23px;border:none; color:#FFFFFF; font:bold";
};
</script>
<input type="button" onclick="window['oCV'+'_THIS_'].getRV().runPDF()" value="Open in PDF"/>
Title: Re: Using one Button to run a Report and Send Report via email
Post by: maxchuie on 29 Nov 2016 01:54:56 PM
did you get this to work.. i have the same requirement as well
Title: Re: Using one Button to run a Report and Send Report via email
Post by: tkjenkin on 31 May 2017 02:33:17 PM
yes.  1st html item with this on my main prompt page

<script>
function nextPage() {
   oCR.sendRequest(cognos.Report.Action.NEXT)
}
</script>

<a href="JavaScript:nextPage()">

Once I click the email report: this goes to the second prompt page with this html item on it

<script>
function autoRefresh() {
setTimeout(oCR.sendRequest(cognos.Report.Action.NEXT), 1000);

}
autoRefresh();
</script>
Title: Re: Using one Button to run a Report and Send Report via email
Post by: smitha on 08 Jan 2018 01:28:03 PM
Hey, i wanted to send the report to a recipient also wanted to write prompt values in the email body. could you please share how you were able to send the report on a click of button. i mean the recipient and body.