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

Enable/Disable Finish Button for Optional Prompts--Cognos 10.2.1

Started by vdts, 16 Jul 2015 05:02:50 AM

Previous topic - Next topic

vdts

Hi,

We have 3 Optional Prompts (2 Value prompts, 1 Date prompt).
Requirement is to have Finish button enabled only when at least any of the above 3 prompts is selected with a value, so that report is not running with all the data.
Tried searching the blogs to get a working javascript(as not able to get any other alternate solution),but no success in achieving the scenario work properly.
Any help/suggestion is appreciated.

Regards,
Vdts

TheFrenchGuy

Hi,

If I understand, you want to show "FInish" button as soon as a value is elected in on of the 3 prompts ?
Prompts are multiselect ? auto-submit ?

Btw, you have to create a variable to render your button : if ParamCount('Parameter Prompt 1)>0 or ParamCount('Parameter Prompt 2)>0 ....

It should works

charlopo

I can think of 2 ways to solve this, depending on what you prefer.

You could put HTML items around the submit button and wrap it with <div> tags, and set style.display="none" through javascript by default, so the Submit button is hidden. Then it's just a matter of changing that property to show the button when 1 prompt has a value. The drawback to this is that if the user presses Enter, it will still submit.

I had to do something similar in a report and needed to disable the submit button and Enter key as well. I did that by creating a required text-box prompt, then setting its Visible property to "no" in Report Studio. I check that the visible prompts are valid through javascript. When the prompts are valid, I use javascript to put some text into the prompt, which enables the Submit button.

vdts

Hi,
Thanks for sharing the inputs.
@ TheFrenchGuy: Yeah...your understanding is correct.However,the prompts are single select and not auto submit(especially can't do it for date prompt), then ParamCount will not evaluate to any results, which I can use to render the Finish Button.

@charlopo: I was trying to do the same initially but stuck at validating the prompts with the script. If you can share inputs or the script, that would be very helpful.

Or any other approach is helpful.

TheFrenchGuy

Hello,

you should try ParamCount function : even if it needs refresh to show the right value, it will works to render prompt button (I did it in some reports).

psrpsrpsr

TheFrenchGuy - the Finish button in my report does not have a property for Render Variable, only Style Variable.

I understand your approach - to create a Boolean variable that returns True when ParamCount(prompt 1) >0 OR ParamCount(Prompt 2) >0... but how do you use this to make it so the Finish button is NOT able to be selected?

dougp

You are hereby granted the Archaeology award for replying to an ancient, dead post. ;)
...although one that interests me at the moment.

I found the same thing.  I have a different problem with the solution:  In this scenario, the Finish button is not disabled.  It is invisible.

To answer your question:  Try using tables.  I used a table with two cells -- one for the Cancel button and one that contains another table with only one cell containing the Finish button.  I can set the render variable on the "Finish" table.

In my case, I need to do this for a prompt page that contains only textbox prompts.  There is no Auto Submit property for a textbox prompt.  I even verified it is not possible by hacking the XML.  Cognos just complains.  The only option, then, would be to require the user to click a Reprompt button to make the Finish button appear.  Unacceptable.

I think JavaScript is the way to go.  I just haven't figured out all of the pieces yet.  As I'm trying to do this in Cognos 11, my solution must involve RequireJS.

Robl

If I understand it correctly the problem is not that you want to hide the prompt button.
The problem is that you don't want the user to be allowed to run the report with no prompts selected.

All I do in this case is create a data item in the report like;
RUN/NORUN  - If (prompt A is null and prompt B is null and prompt C is null) then ('NO RUN') else ('RUN')

And a filter that says;
RUN/NORUN = RUN

This way if the user selects no prompt values the report is empty.
Change the empty object display to put up some text for "Please run the report with Prompts selected" and it's all sorted.



psrpsrpsr

Robl, can you clarify how you refer to the prompt - like:
a.)  ?promptName? IS NULL
or
b.) ParamValue('PromptName') IS NULL

I have run into issues referencing in reports that reference parameter values that are null.