Topic
  • 3 replies
  • Latest Post - ‏2013-10-21T14:08:37Z by OpherB
bussz
bussz
2 Posts

Pinned topic Multiple Optional Prompts

‏2013-10-19T04:53:01Z |

Hi All,

We have 4 prompt value pairs of with only one is mandatory. In the details filter we are using filter for all the prompts with 'or' condition between them.

The report is generated fine when all the prompts are selected but failing when any of them are not selected.

Is there a way to generated the report when only 1 prompt, 2 prompts, 3 prompts and all the prompts are selected.

Updated on 2013-10-19T04:55:01Z at 2013-10-19T04:55:01Z by bussz
  • OpherB
    OpherB
    664 Posts

    Re: Multiple Optional Prompts

    ‏2013-10-20T04:45:03Z  

    The best way to do this that I can think of is to set a default value for all of the prompts such as "NONE" or "NA" as a Static Choice. If the user doesn't change it you can test for the default value in the filter expression and act accordingly. The prompts can stay "optional" but they are all selected.

    Once you get to Cognos BI 10.2.1 you'll have access to the Prompt API with JavaScript and will be able to do much more....

    Good luck,
    Opher

     

    Updated on 2013-10-20T04:45:38Z at 2013-10-20T04:45:38Z by OpherB
  • bussz
    bussz
    2 Posts

    Re: Multiple Optional Prompts

    ‏2013-10-20T18:05:24Z  
    • OpherB
    • ‏2013-10-20T04:45:03Z

    The best way to do this that I can think of is to set a default value for all of the prompts such as "NONE" or "NA" as a Static Choice. If the user doesn't change it you can test for the default value in the filter expression and act accordingly. The prompts can stay "optional" but they are all selected.

    Once you get to Cognos BI 10.2.1 you'll have access to the Prompt API with JavaScript and will be able to do much more....

    Good luck,
    Opher

     

    Thanks for the replay OpherB.

     

    We already tried this way. But it is throwing errors.

     

    if(((?CriteriaValue1?) != 'Criteriavalue1') and ((?CriteriaValue2?) != 'Criteriavalue2') and ((?CriteriaValue3?) = 'Criteriavalue3') and ((?CriteriaValue4?) = 'Criteriavalue4') )
    then(
    if( ?OperatorValue? = 'OR')
    then(
    [Filter Condition for 2 prompts]
    )
     
    else(
    [Filter Condition for 2 prompts]
    )
    )

     

    In the above condition CriteriaValue is the default value assigned to prompt.

  • OpherB
    OpherB
    664 Posts

    Re: Multiple Optional Prompts

    ‏2013-10-21T14:08:37Z  
    • bussz
    • ‏2013-10-20T18:05:24Z

    Thanks for the replay OpherB.

     

    We already tried this way. But it is throwing errors.

     

    if(((?CriteriaValue1?) != 'Criteriavalue1') and ((?CriteriaValue2?) != 'Criteriavalue2') and ((?CriteriaValue3?) = 'Criteriavalue3') and ((?CriteriaValue4?) = 'Criteriavalue4') )
    then(
    if( ?OperatorValue? = 'OR')
    then(
    [Filter Condition for 2 prompts]
    )
     
    else(
    [Filter Condition for 2 prompts]
    )
    )

     

    In the above condition CriteriaValue is the default value assigned to prompt.

    You should include the error messages being generated.

    But the problem is probably due to the "if" statement. You cannot use "if" in a filter because a filter, by definition, is already a logical test.

    So, looking at what you have sent, I would write it something like this:

    ((?CriteriaValue1?) != 'Criteriavalue1') and ((?CriteriaValue2?) != 'Criteriavalue2') and ((?CriteriaValue3?) = 'Criteriavalue3') and ((?CriteriaValue4?) = 'Criteriavalue4') ) and (?OperatorValue? = 'OR') and ([Filter Condition for 2 prompts])
     OR
    ([Filter Condition for 2 prompts])

    I have not validated all of the parenthesis and other syntax.

    Good luck,
    Opher