Hi ,
I have four prompts on my page and when report is run I show the two prompts with default value "All" selected. And User can change values and the prompt will autosubmits.
I wanted to give a rerun button , which will automatically set my two prompts to "All" state as like the report was run for the first time.
If I select a value say specific region instead of All ,and use the prompt rerun button , it doesnt goes back to All selection but rather refreshes the report with current selection.
Is there a way to have a button which will run the report as if it was run for the first time. Or should I use a java script to achieve this.
Thanks,
<SCRIPT>
<!--
function reRunReport(){
//while Running report
try
{
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
var prompt = fW._oLstChoicesPrmptSubRegion;
prompt.options[2].selected = true;
var prompt1 = fW._oLstChoicesPrmptProduct;
prompt1.options[2].selected = true;
promptButtonFinish();
}
catch(err) {}
}
//-->
</SCRIPT>
<span class="bb">
<INPUT TYPE="BUTTON" VALUE="Reset" onClick="reRunReport();">
</span>
I wrote this code and it works, but is there a better way to achieve the same. should I add any checks to avoid run time errors ?
Thanks,
Create a drill-through link back to the same report. You can make the link look like a button, if you wish.
Hi,
The above code works in cognos report studio , but it doesnt works on cognos workspace. When I use the below code on my reports placed on 2 tabs in work space.
<SCRIPT>
<!--
function reRunReport(){
//while Running report
try
{
var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)
{ fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_);}
if(fW)
{
var prompt = fW._oLstChoicesPrmptSubRegion;
prompt.options[2].selected = true;
var prompt1 = fW._oLstChoicesPrmptProduct;
prompt1.options[2].selected = true;
promptButtonFinish();
}
}
catch(err) {}
}
//-->
</SCRIPT>
<html lang="en">
<head>
<meta charset="UTF-8" />
<style type="text/css">
#Reset{
background-Color: #A4BED2;
width: 85px; height: 25px;
}
</style>
</head>
<body>
<input id="Reset" value="Reset" onclick="reRunReport();" type="button" />
</body>
</html>
The first report on tab1 resets on the button click, but the second report doesnot.
Please help on how to modiy the java script, I think the second report is not able to get the controls from tab2 .
Thanks,