Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
  • 1.  Prompt Validation

    Posted Mon August 19, 2024 06:22 AM
    Edited by Scott Hughes Mon August 19, 2024 06:23 AM

    Hey all

    I have a prompt page with 4 search & select prompts, they are all optional, with no default values. What I want however is that at least one prompt to be used.

    Not sure how to achieve this, suspect it will be via a JavaScript button, but don't have the technical knowhow to write one

    Can anyone assist me in achieving this?

    Cheers

    Scott



    ------------------------------
    Scott Hughes
    ------------------------------



  • 2.  RE: Prompt Validation
    Best Answer

    Posted Mon August 19, 2024 07:39 AM
    Edited by Scott Hughes Mon August 19, 2024 11:01 AM

    Hi Scott,

    I'm not a fan of Java Script as this needs further knowledge. Use Cognos built-in features instead. You just need a variable that controls the visibility of prompt buttons.

    Let's say we have a report with these four optional prompts on the first page:

    I created a small table with one column and three rows to place the three prompt buttons Cancel, Reprompt and Finish in each row:

    Now I want that the Finish button is only visible when at least one prompt is selected. Go to the variables page and create a new Boolean variable.

    The expression must return a true/false result. Therefore I wrote the following statement (drag and drop the parameters if you like):

    ParamValue('pReturnReason') is not null
    OR
    ParamValue('pRegion') is not null
    OR
    ParamValue('pOrderMethod') is not null
    OR
    ParamValue('pProductLine') is not null

    Then go back to your prompt page and drag a conditional block into the cell where the Finish button is and link this block to the variable (in my case "PromptSelected").

    You now get one block for each returned result of the variable. In this case, it's one for Yes and one for No. I placed a simple text in the "No" block and the Finish button in the "Yes" block. 

    Done.

    If there's nothing selected the text appears. If a user selects at least one prompt and hits "Reprompt" the Finish button appears.



    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ Gebr. Müller Apparatebau GmbH & Co. KG
    Ingelfingen
    ------------------------------



  • 3.  RE: Prompt Validation

    Posted Mon August 19, 2024 09:56 AM

    Many thanks Robert, a great solution I will most definitely be implementing!

    Cheers



    ------------------------------
    Scott Hughes
    ------------------------------



  • 4.  RE: Prompt Validation

    Posted Mon August 19, 2024 10:11 AM

    @Scott Hughes if you'd like to give Kudos, please mark the post as "best answer". Thanks.



    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ Gebr. Müller Apparatebau GmbH & Co. KG
    Ingelfingen
    ------------------------------