If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Search and Select Prompt Report refresh Issue

Started by rprameshwor, 26 May 2014 04:22:39 AM

Previous topic - Next topic

rprameshwor

Hello ,

On my report page , i have a few prompts and one of them being search and select prompt. [ Prompts are present both on the prompt page and report page ]
when a search is made on the SnS , the report is run with the values that were selected before doing the search.

eg:-
If i have a sales report  with filters on department,location , vendor [ search and select ].
If i selected Dept- D1 , Location - L1 and search for a vendor 'foo' , then the SnS shows search result for 'foo' but
also runs the report based on only the dept D1 and location L1 filters.

How do i change this behaviour so that the report is not generated when the user searches for any vendor, but generated only when the user clicks the 'finish' button.

Report Studio 10.1.1



gosoccer

rpramershwor,

I'm facing the same issue and have not identified a way to clear the Select and Search Box after the user selects to go back the prompt page
and run a different search. The previous search information is not getting refreshed.

Anybody who have a way of dealing with this issue please let us know.
thx so much in advance for your time.

Cognos Report Author 10.1.2 - Relational Model.

Please help!!



navissar

There are several ways to deal with it.
The most difficult case is when the SnS prompt is not required but optional.
Here's a technique I like using:
1. Create a text box prompt, name it "isFinish", name the parameter "isFinished", default value 0.
2. Hide it.
3. Use JS to replace the finish button's functionality - when finish is clicked, fist populate the text box prompt with the value "1", only then finish. The JS varies according to whether you're using 10.2 and up or a lower version, I'll add the scripts in the end.
4. create a conditional block.
5. Create a boolean variable paramValue("isFinish")='0'
6. Assign the variable to the conditional block.
7. Keep the "Yes" block empty.
8. Put your report objects (Lists, crosstabs, charts etc) in the "No" block.
9. You're done! The report will only show if your finish button has been clicked.

Following are the scripts for 10.2 and pre-10.2. Both need to be put in an html item after the finish button and all the prompts.


The following is the script for 10.2.
<script>
//this is for 10.2+
var RNA={};//avoid collisions
RNA.populatePromptAndFinish=function(){
var oCR=cognos.Report.getReport("_THIS_"),
thePrompt=oCR.prompt.getControlByName("isFinish"),//change accordingly
theValue=[{'use':1,'display':1}];

thePrompt.setValues(theValue);
setTimeout('cognos.Report.getReport("_THIS_").sendRequest( "FINISH");',200);

}
//get finish button
var allButtons=document.getElementsByTagName("button");
for(var i=0;i<allButtons.length;i++){
if(allButtons[i].id.indexOf("finish")==0&&allButtons[i].name.indexOf("finish")==0){
allButtons[i].onclick=function(){RNA.populatePromptAndFinish();};
}
}
</script>


For earlier versions, we need to go the long way. This is the code for pre-10.2:
<script>

var fW = (typeof getFormWarpRequest == "function" ? getFormWarpRequest() : document.forms["formWarpRequest"]);
if ( !fW || fW == undefined)  {
fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );
}
var suffix = "";
if (fW.elements["cv.id"]){
suffix = fW.elements["cv.id"].value;
}   

function populatePromptAndFinish(){
var thePrompt=fW._textEditBoxisFinish;
thePrompt.value=1;
setTimeout("eval('oCV'+suffix+'.promptAction(\"finish\");');",200);

}
//get finish button
var allButtons=document.getElementsByTagName("button");
for(var i=0;i<allButtons.length;i++){
if(allButtons[i].id.indexOf("finish")==0&&allButtons[i].name.indexOf("finish")==0){
allButtons[i].onclick=function(){populatePromptAndFinish();};
}
}
</script>


rprameshwor

#3
Hello Nimrod ,

Thanks for the detailed reply.
I just tried out your approach and found that the report objects inside the conditional block are not rendered at all  unless the text box prompt has value 1.
Could we somehow change it so that objects inside conditional block doesnt completely disappear but just that it is not UPDATED unless the value is 1.

I dont want the report objects to disappear from the page , i would like the previous report output to stay there.

So , if user supplier Dept- D1 Location - L1  from prompt page , he is shown the report page with sales for dept d1 location l1.

Now, when user selects D2 , L2 and performs search in vendor , i would like the previous output of D1-L1 to be there in the report. The new result for D2-L2 and vendor[ if selected] should be generated only after the user clicks 'finish'.

Let me know if there is some way around this.

Thanks


navissar

I wouldn't go there. It's possible, but it's a long, dark path that would live a report very complicated to maintain and also wouldn't perform very well. What you'll basically need to do is to ghost the entire report - prompts, queries, the works - and basically create two reports, one based on prompts and one based on their shadows, and have the shadows only take value if finish is clicked. Moreover, the report will still run - only with the old values again, so performance wouldn't be great. I'd avoid a solution such as this one.
In your stead, I'd probably look for a way to change the SnS prompt to something less...horrible. There are many possible workarounds for SnS prompts.

gosoccer

Nimrod,
Thanks so much. I'll try your recommendations today.
I very much appreciate your time.


Karanag

Nimrod,
I have used the same code which you mentioned. Now when I click on finish button I am able to see the list report. In my report I need one more button i.e. 'Reset' so when I click on that It should hide that list . In cognos Reset button is not there so i have created one using JS. Could you guide me how to hide the list when click on reset button .