COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: actcognosuser on 03 Dec 2021 01:00:27 PM

Title: Parameter display Value question
Post by: actcognosuser on 03 Dec 2021 01:00:27 PM
Hello,

How do you display "ALL' when Select all is clicked in a value prompt?
I have a tried the following options with no luck.

CASE
WHEN (ParamDisplayValue('ABC') is missing)
then ('All')
ELSE (ParamDisplayValue('ABC'))
END

Parameter display value ABC is a concatenated value of area code and Area name.

When 3-4 areas are selected , the paramcount(paramvalue('ABC')) is returning zero.



Please advise.
Title: Re: Parameter display Value question
Post by: MFGF on 03 Dec 2021 01:35:03 PM
Quote from: actcognosuser on 03 Dec 2021 01:00:27 PM
Hello,

How do you display "ALL' when Select all is clicked in a value prompt?
I have a tried the following options with no luck.

CASE
WHEN (ParamDisplayValue('ABC') is missing)
then ('All')
ELSE (ParamDisplayValue('ABC'))
END

Parameter display value ABC is a concatenated value of area code and Area name.

When 3-4 areas are selected , the paramcount(paramvalue('ABC')) is returning zero.



Please advise.

Hi,

ParamDisplayValue() and ParamValue() are functions you can use in a layout calculation but not a query calculation. Where are you using your expression?

If the user chooses the 'Select All' option from the prompt, the parameter would contain all the values from the prompt, separated by commas and spaces - eg 'Camping Equipment, Golf Equipment, Mountaineering Equipment, Outdoor Protection, Personal Accessories'

You could code a layout calculation that had an expression like this:

if (ParamDisplayValue('yourParameter') = 'Camping Equipment, Golf Equipment, Mountaineering Equipment, Outdoor Protection, Personal Accessories') then ('ALL') else ParamDisplayValue('yourParameter')

Cheers!

MF.
Title: Re: Parameter display Value question
Post by: actcognosuser on 03 Dec 2021 02:18:50 PM
HI MFGF,

I am using a layout calculation . If there are 100 regions, it is wise to list all of the regions in the layout expression or is there a better way to resolve this?
Title: Re: Parameter display Value question
Post by: dougp on 06 Dec 2021 02:30:18 PM
I generally encourage users to use the "Deselect All" option to select everything (ignore this filter).  "Select All" can make for a slow query.
Title: Re: Parameter display Value question
Post by: actcognosuser on 14 Dec 2021 11:06:18 AM
Hi MFGF,

The solution with comma separated values is not working for multiple values though it is a multiselect value prompt.

It shows all the values instead 'ALL'.

if (paramdisplayvalue('?reg?) in ('A' , 'B', 'C'))
then('ALL')
else (paramdisplayvalue('?reg?))

Output is A, B , C
Title: Re: Parameter display Value question
Post by: MFGF on 14 Dec 2021 11:35:12 AM
Quote from: actcognosuser on 14 Dec 2021 11:06:18 AM
Hi MFGF,

The solution with comma separated values is not working for multiple values though it is a multiselect value prompt.

It shows all the values instead 'ALL'.

if (paramdisplayvalue('?reg?) in ('A' , 'B', 'C'))
then('ALL')
else (paramdisplayvalue('?reg?))

Output is A, B , C

The syntax you are using is different than the expression I posted. My expression uses an = operator, but you have substituted this with 'in'.

Cheers!

MF.
Title: Re: Parameter display Value question
Post by: actcognosuser on 14 Dec 2021 11:48:25 AM
Using  '= ' yields a parsing error. For a multiselect value prompt don't we need the in operator?
Title: Re: Parameter display Value question
Post by: dougp on 14 Dec 2021 01:40:12 PM
It's more than just the =.  Take a look at the rest of your syntax.  paramdisplayvalue('?reg?) doesn't look right.  Try dragging in the parameter from the Available components: pane in the expression editor.