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

JavaScript code for page hiding in Report Studio ...

Started by sudhajan, 15 Jan 2009 12:50:28 AM

Previous topic - Next topic

sudhajan

Hi,
can anybody let me know if there is any posibility to hide/show a page using javascript in Report Studio?

If yes , code will be very helpful.

Thanks in advance.

Regards

masilabalu


<script language="JavaScript">
//<!--
var g_NavOpen = 0;

function togglePromptDiv(){
if (g_NavOpen){
document.getElementById('divPromptArea').style.display="none";
document.getElementById('anchorHideShow').innerHTML="Show Filter Prompt(s)";
g_NavOpen = 0;}
else{
document.getElementById('divPromptArea').style.display="";
document.getElementById('anchorHideShow').innerHTML="Hide Filter Prompt(s)";
g_NavOpen = 1;}
}
//-->
</script>
<a href="javascript:togglePromptDiv()" border="0" id="anchorHideShow" class="blreport-filter">Show Filter Prompt(s)</a>


use this code.... :)

sudhajan

Thanks for the quick reply...
i am bit new to C8 and definitely very new javascript in Reports, so dont mind even for silly questions ..

if my understanding is right, this code is going to hide the "'divPromptArea'" <DIV> area in the report right ??

My thing is
suppose there are 2 pages in report explorer, page1 and page2
and depending on a prompt value I need to display either page1 or page2 ..
then is it possible to hide the whole page using javascript ?? 

may be something like    document. page1.style.display ="none"


Thanks for the help in advance


wyconian

Have you tried using render variables on the pages rather than Javascript?

That way you would only display the page(s) selected by the user via a prmopt

sudhajan

I tried rendering variables also, its was hiding only the data in the page instead of the whole page.
With same example Page1 and page2 .. i used a rendering variable for page2.
And if i display Page1 , the data is comming fine in page1 but the page2 is also getting displayed with nothing in it(empty). for me this empty page should not get displayed when the report is run.

pls suggest

Thanks

Sunchaser

Hi,

I've used rendering variable on pages in 8.3, and it was working fine; I don't know what could cause such behaviour.
Are you sure you have used the variable at the "page" level, and not on something else like page body or things like that ?

jshanks

Hello,

Render variables at the page level would probably be the best approach.  Javascript often "breaks" when reports are upgraded to a newer version.

sudhajan

we also have 8.3.

Could you please let me know the steps for Render variables. I would like to redo /recheck ,in case i missed out somethings.

scenario:
There are 2 pages in report explorer, page1 and page2
and there are two prompts, If 1st prompt values are selected then only page1 should be displayed and if 2nd prompt values are selected , only page2 should be displayed.

Thanks in advance

jshanks

Here are the steps, based upon a report built against the Cognos sample data:

1.  Create Page 1 and Page 2 for your report.

2.  Create the prompt page with Prompt 1 and Prompt 2.

3.  Create a BOOLEAN variable with the following expression:  ParamDisplayValue('Parameter1') IS NOT NULL.  Name the expression "Parameter1 is not NULL"

4.  Create another BOOLEAN variable with the following expression:  ParamDisplayValue('Parameter2') IS NOT NULL.  Name the expression "Parameter2 is not NULL"

5.  Select "Page1" from the Page Explorer in Report Studio.

6.  Click the Page Body and then click the Ancestor Button to display parent objects for the Page Body.

7.  Select "Page" from the local menu that appears when you select the Ancestor button.  The properties for the Page object will appear in the Properties pane.

8.  Click the "Render Variable" property and select the "Parameter1 is not NULL" variable from the drop-down list.  This will allow Page1 to be rendered whenever the prompt value for Parameter1 is not NULL.

9.  Select "Page2" from the Page Explorer in Report Studio.

10.  Click the Page Body and then click the Ancestor Button to display parent objects for the Page Body.

11.  Select "Page" from the local menu that appears when you select the Ancestor button.  The properties for the Page object will appear in the Properties pane.

12.  Click the "Render Variable" property and select the "Parameter2 is not NULL" variable from the drop-down list.  This will allow Page2 to be rendered whenever the prompt value for Parameter2 is not NULL.


In this scenario, when one or more values for Parameter1 are selected, Page1 will appear in the report output.  If one or more values for Parameter2 are selected, Page2 will appear in the report output.  If the user selects values in both parameters, both Page1 and Page2 will be rendered in the output.

I hope this is what you were looking for.

Jason

sudhajan

Thx ..

But will this work if we have pagesets ?
That is, if page1 is in pageset1 and page2 in pageset2 then ??

Here in my scenario, in prompt page, if i select page1, then page1 gets displayed with data and also page2 is displayed as empty page.
Thats the issue.

Looks like pageset is causing this problem.

Note : if the pages are in same pageset or there are no pagesets, then the 2nd page is hidden/rendered based on prompt values correctly.

Can somebody help me out pls....