COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Kathir on 01 Mar 2012 04:45:36 AM

Title: Optional prompt - Do not apply the filter if no values were selected
Post by: Kathir on 01 Mar 2012 04:45:36 AM
Hi,

  I have to implement the following filter/prompt behavior in my report.

  I have 2 optional value prompts in my report.

  If the user select value for one prompt and does not select value for the 2nd prompt, then I should consider only the prompt selected and ignore the other prompt, means I should not apply the default behavior of optional prompt if nothing is selected.

on the other hand, If the user does not select values for both the prompt, then I should apply the default behavior( all values).

Kindly, suggest a way to accomplish this. Thanks for your time in advance.

Title: Re: Optional prompt - Do not apply the filter if no values were selected
Post by: blom0344 on 01 Mar 2012 07:10:32 AM
Hmm, looks like you exactly described the way optional prompts work (as designed), which means you can use them 'as is'.  Or am I missing your point?
Title: Re: Optional prompt - Do not apply the filter if no values were selected
Post by: absriram on 02 Mar 2012 08:57:38 PM
Kathir,

What kind of prompts do you have, value prompts OR text box prompt or something else?

It is not sufficient if you set the prompt's "Required" property to "No". You should also make the corresponding filters as "Optional".

Also, make sure you are not using the prompt values in data item expressions. If you do, then the prompts become required.

Sriram.
http://www.cognosonsteroids.com (http://www.cognosonsteroids.com)
Title: Re: Optional prompt - Do not apply the filter if no values were selected
Post by: Kathir on 03 Mar 2012 05:25:40 AM
Hi Blom0344,Sriram:

   Thank you.

  Let me try to describe the requirement,  I have 2 optional value prompts in my report, Terminals and Operators

  I have to implement the below behavior for the report

1. If the user selects a terminal from TerminalIDs prompt and does not select any operator from
OperatorIDs prompt , then
I should consider only the Terminal IDs and should not apply the default behaviour of optional prompt (
ALL) for OperatorIDs.
i.e. The report should have data only for the selected terminals and no operator related data should be
presented.
e.g. if the user selects only Terminal5 and no operator ids, then the report should have only Terminal5 related
info.

2. If the user selects a Operator from OperatorIDs prompt and does not select any terminal from
TerminalIDs prompt , then
I should consider only the OperatorIDs and should not apply the default behaviour of optional prompt (
ALL) for TerminalDs.
i.e. The report should have data only for the selected Operators and no terminal related data should
be presented.
e.g. If the user selects only 02 and no terminal ids, then the report should have only operator O2 related
info.

3. If the user selects both terminal and operator(Terminal1 and Operator2
) , then the report should be presented with both Terminal1 and Operator2 detaisl ( cognos
default prompt behavior )

4. If the user does not select any Operators and terminals , then the report should have both operator
and terminal data ( Default behavior of cognos optional prompt )

I found prompt macro with tokens/ prompt macro with default value, can be used, but the problem is,
I am not able to accomplish the behavior mentioned in 4, as the filter behavior got modified to select
none(by supplying a default value(None) for the prompt if the user doesnot select a value from the prompt)

Kindly, help me in this.
Title: Re: Optional prompt - Do not apply the filter if no values were selected
Post by: Lynn on 05 Mar 2012 07:21:06 AM
Not sure what I'm missing but it sounds like you can just use optional prompts and render variables or conditional formatting to control displaying or hiding columns.

There is a paramCount function that you can use in a boolean variable or in an advanced conditional format expression to determine if operators or terminals were selected. Then hide or show the appropriate elements.

Doesn't sound like prompt macros are really required at all in this situation.

Title: Re: Optional prompt - Do not apply the filter if no values were selected
Post by: Kathir on 07 Mar 2012 08:22:17 AM
Hi Lynn,
Thank you. I was able to accomplish the requirement using ParamCount() and conditional rendering.

  Thank you very much.