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
Have you tried switching "is null" for "is missing" ? You need to let us know what platform you're using etc.
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.
Hi Chris,
"is missing" also not working..
I am working in cognos 10.2.2 report studio and the data base is db2..
Hi Robl
(?parameter? = '' ) and #prompt('P_paramname','string','unselected')# = 'unselected' are also not wrking... :( :( :( :(
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.
Use "is not null" instead of "is null" in the expression.
You can also check on
http://cogxprt.blogspot.com
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'
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')
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..
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')
Robl,
All these works perfectly in "report expression" but it does not work in "filter expression"..