Hide 2 top rows in prompt

When making a custom prompt, eg for switching between crosstab and chart, you can hide the first two lines of the prompt.

Put a html item besides the prompt and put the next code in there:

<script language=”javascript”>

var f = getFormWarpRequest();

var list = f._oLstChoicesPrompt1;

list.remove(1);

list.remove(0);

list.removeAttribute(“hasLabel”);

</script>

Prompt1 is the name of the prompt. This can be found at the bottom of the properties of the prompt.

This script is used in Cognos 8.4.1

Update 07-12-2012

The javascript above only works in a report. When you put the report in a dashboard the javascript doesn’t work properly.

The following javascript works both in Report Studio reports and on reports on a dashboard:

<script language=”javascript”>

var fW = (typeof getFormWarpRequest == “function”?getFormWarpRequest() : document.forms[“formWarpRequest”]);

if( !fW || fW == undefined)

{

fW = ( formWarpRequest_THIS_ ? formWarpRequest_THIS_ : formWarpRequest_NS_ );

}

var list = fW._oLstChoicesPrompt1;

list.remove(1);

list.remove(0);

list.removeAttribute(“hasLabel”);

</script>

Email this to someoneShare on FacebookShare on LinkedInTweet about this on TwitterShare on Google+Pin on Pinterest

View Table or Chart with prompt

In report you often want to switch between a crosstab/table or a chart. You can give the user this selection with a prompt and a variable.

1. Insert a value prompt above the table. Parameter is p_view

2. Insert static choises:

Use      View

Table   Table

Chart   Chart

3. Set standard selection to the type you want to see default, eg. Chart

4. Create a variable “VarView” with the expression: If (ParamValue(‘p_view’) = ‘Table’) then ‘Table’ else ‘Chart’

5. Add values to the variable: Table, Chart

6. Make sure that the crosstab/table is placed in a table. Also the chart has to be placed in a table.

7. Click once on the table cell the crosstab/table is placed in

8. Choose Stylevariable = “VarView”

9. Click once an the table cell the chart is placed in

10. Choose Stylevariable = “VarView”

11. Now select the value “table” from the variable, the centre gets green

12. Select the tablecell where the chart is placed and set “box type” to “none”

13. Now select the value “chart” from the variable

14. Select the tablecell where the crosstab/table is placed and set “box type” to “none”

15. Add some script with a html item next to the value prompt to hide the first 2 lines.

      See the article Hide 2 top rows in prompt on this site

Email this to someoneShare on FacebookShare on LinkedInTweet about this on TwitterShare on Google+Pin on Pinterest