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

value of the prompt if not entered anything

Started by kishor2010, 23 Jan 2015 04:51:41 AM

Previous topic - Next topic

kishor2010

HI, I have a problem in report studio. please help me to figure this out..
i have a optional prompt, i want to check whether the value is selected or not.. Please help how to check..
if (?parameter? is null ) then ('1') else ('2')
or
if (ParamDisplayValue('parameter') is null ) then ('1') else ('2')
Both the above are not working..
Suppose if i select any value in the prompt then the else part works and i get the result as 2, if i wont select anything then i'm not getting the result as 1

BigChris

Have you tried switching "is null" for "is missing" ? You need to let us know what platform you're using etc.

Robl

You could also try a zero length string.
(?parameter? = '' )

Alternatively use a macro prompt where you can define the blank value.
#prompt('P_paramname','string','unselected')# = 'unselected'

You could set 'unselected' to be whatever you want.

I've also found that for optional prompts the prompt macros tend to run a little faster than having default values in screen based prompts; but I've not actually done any true speed tests.

kishor2010

Hi Chris,
"is missing" also not working..
I am working in cognos 10.2.2 report studio and the data base is db2..

kishor2010

Hi Robl
(?parameter? = '' ) and  #prompt('P_paramname','string','unselected')# = 'unselected' are also not wrking...  :( :( :( :(

Robl

Are you sure the prompt has nothing selected?
Have you entered a default value in the prompt on the prompt page?

Try adding a layout calculation on the report that shows the paramvalue and paramdisplayvalue.
You could also try conatenating a string on the front and back of it to see if it's returning spaces, null or zero length string or something else.


keshavchhn

Use "is not null" instead of "is null" in the expression.

You can also check on

http://cogxprt.blogspot.com

kishor2010

Hi Robl,
I tried as u said,
'a'+ParamDisplayValue('p_AggBand11')+'s'
If i select the prompt value then it will display as below
aCATHAY, CHEUNGKONG,s
if nothing is selected in the prompt then it will not display anything, not even 'a' and 's'

Robl

In which case it's NULL.

Try this
Make sure there is no filter on the report that does anything with the parameter.
Then make a data item with the following calculation; see what happens.
if (?param? is null ) then ('A') else ('B')

kishor2010

Hi Robl,

If i use the parameter(?param?) in the data item, then that parameter becomes required..
so i can't continue to report without entering the parameter value..

Robl

Good point.
I guess we're back to looking at using a prompt/parameter macro.

Although, looking back at the orginal question..
Add a layout calculation with;

if (ParamValue('param') is null ) then ('a') else ('b')

kishor2010

Robl,
All these works perfectly in "report expression" but it does not work in "filter expression"..