COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: yoniw on 22 May 2014 08:57:58 AM

Title: Button to mail report/Button to save report output
Post by: yoniw on 22 May 2014 08:57:58 AM
Hey,
We are changing the look & feel of Cognos completely, and one of the requests is to design two new buttons for sending report mail and saving report output.

I searched across the web and dived deep into the javascripts of Cognos... the only outcome i reached is that i copied the HTML of the buttons inside the "Keep This Version" and pasted it inside an html item - it was an almost success, it was successful  only when i clicked the "keep this vesrion" and then went to the buttons i created and clicked on them. if i just loaded the page

Anyone knows how to do it?

Attached screenshots

Thanks!!!
Yoni
Title: Re: Button to mail report/Button to save report output
Post by: CognosPaul on 25 May 2014 02:10:28 AM
You have 10.2.1, yeah?

Put this at the top of the page, or with the rest of your embedded JS:
<script>
function emailPage()
{
   try   {window['oCV'+'_THIS_'].getRV().SendReport(false);}
   catch (err) {}
}
</script>


Now put this wherever you want the button to be:
<input type="button"
class="ToolbarButton"
onclick="emailPage()"
value="Email"
ACCESSKEY="e"
title="Keyboard shortcut: alt-e">

Title: Re: Button to mail report/Button to save report output
Post by: yoniw on 27 May 2014 09:54:00 AM
Paul,
You are the king of kings.

Thanks!!
Yoni
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 08 Dec 2015 03:17:58 AM
Quote from: CognosPaul on 25 May 2014 02:10:28 AM
You have 10.2.1, yeah?

Put this at the top of the page, or with the rest of your embedded JS:
<script>
function emailPage()
{
   try   {window['oCV'+'_THIS_'].getRV().SendReport(false);}
   catch (err) {}
}
</script>


Now put this wherever you want the button to be:
<input type="button"
class="ToolbarButton"
onclick="emailPage()"
value="Email"
ACCESSKEY="e"
title="Keyboard shortcut: alt-e">


hello guys,
i try to do this with SaveReport(), but it is not work.
can you help me pls?

I put this at top:
<script>
function savePage()
{
   try   {window['oCV'+'_THIS_'].getRV().SaveReport(false);}
   catch (err) {}
}
</script>


And put this wherever I want the button to be:
<input type="button"
class="ToolbarButton"
onclick="savePage()"
value="Save"
ACCESSKEY="e"
title="Keyboard shortcut: alt-e">


But i getting an error:
RSV-SRV-0001
       The request is missing the objectPath


I need Save report version, like "Save Report" button.
Also, I need send this report to two person with this button.

Thanks,
Best Regards Alex

Title: Re: Button to mail report/Button to save report output
Post by: BigChris on 08 Dec 2015 03:27:49 AM
 don't do javascript, but it looks like you're trying to save a report by saving a page...doesn't feel like that should work to me
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 08 Dec 2015 03:30:17 AM
Quote from: BigChris on 08 Dec 2015 03:27:49 AM
don't do javascript, but it looks like you're trying to save a report by saving a page...doesn't feel like that should work to me

i trying to do that:
<button type="button" name="SAVE" id="SAVE777" class="SAVE" onmouseover="this.className = 'clsPromptButtonOver'" onmouseout="this.className = 'clsPromptButton'" onclick="window.oCV_THIS_.getRV().SaveReport('_THIS_')" style="">SAVE</button>

but getting the same error...
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 08 Dec 2015 05:41:17 AM
I trying to do this:
http://www-01.ibm.com/support/docview.wss?uid=swg21433541

but getting same error...
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 08 Dec 2015 06:05:29 AM
OMG, sorry guys,

my variant with:
<button type="button" name="SAVE" id="SAVE777" class="SAVE" onmouseover="this.className = 'clsPromptButtonOver'" onmouseout="this.className = 'clsPromptButton'" onclick="window.oCV_THIS_.getRV().SaveReport(false)" style="">SAVE</button>

is work well!!

only from portal, BUT DONT WORK in report studio...
Title: Re: Button to mail report/Button to save report output
Post by: BigChris on 08 Dec 2015 06:45:26 AM
I've just split your code up a bit to make it a bit easier to read:

<button
type="button" name="SAVE"
id="SAVE777" class="SAVE"
onmouseover="this.className = 'clsPromptButtonOver'"
onmouseout="this.className = 'clsPromptButton'"
onclick="window.oCV_THIS_.getRV().SaveReport(false)"
style="">
SAVE
</button>


I think it makes sense that that code only takes effect once the report runs...the Report Studio is only building the structure of the report. The HTML (and the associated javascript) only gets executed once the report is run - at least that's the way I've always understood it.
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 08 Dec 2015 06:55:41 AM
Quote from: BigChris on 08 Dec 2015 06:45:26 AM
I've just split your code up a bit to make it a bit easier to read:

<button
type="button" name="SAVE"
id="SAVE777" class="SAVE"
onmouseover="this.className = 'clsPromptButtonOver'"
onmouseout="this.className = 'clsPromptButton'"
onclick="window.oCV_THIS_.getRV().SaveReport(false)"
style="">
SAVE
</button>


I think it makes sense that that code only takes effect once the report runs...the Report Studio is only building the structure of the report. The HTML (and the associated javascript) only gets executed once the report is run - at least that's the way I've always understood it.

Thanks,
i need to Save Report Version into custom folder, not in "Version in report",
is it possible?

How to create button with function:
send report to AbcMen@mail.com without accept (1 click - 1 send)  ?
Title: Re: Button to mail report/Button to save report output
Post by: chiz on 23 Dec 2015 12:32:59 AM
Quote from: chiz on 08 Dec 2015 06:55:41 AM
How to create button with function:
send report to AbcMen@mail.com without accept (1 click - 1 send)  ?
Anybody knows?