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

Passing a Parameter into a Data Item

Started by vanlang, 27 Sep 2013 02:51:13 PM

Previous topic - Next topic

vanlang

Good afternoon Cognoise world!

In my report, there is a value prompt which sets a parameter. The parameter IS NOT required (i.e. it is optional)

I then have a data item, that I created, and I use the contents of the parameter to help determine the data item, via the case statement below:

CASE ?parameter? IS NULL

WHEN NOT [field] OR NULL
      THEN 'text 1'

END

The statement works, so the coding is not the issue, the issue being that it turns the aforementioned parameter Required, which is not what I want.

If anyone knows how to fix this, or needs clarification, please let me know!

Thanks,

-- V

blom0344

Reference within a dataitem does indeed make the parameter mandatory.  If you think this through , it is only logical. Your case can only be evaluated IF a value exist to be compared.

CognosPaul

But you can make it optional by providing a default value.

For example:

case #prompt('parameter','string',sq('default'))#
when 'default' then 'default action'
when 'and' then 'and action'
when 'so' then 'so action'
else 'on'
end

vanlang

Thank you very much for your help!

It did make sense that it needed to be mandatory after I thought about it a little!

But both solutions worked! Thanks again!

maxchuie

Hi CognosPaul
I did this and i get 'All' as the rank for everything

case #prompt('?pRankGroup?','string',sq('?pRankGroup?'))#
When 'Top 5' then '5'
When 'Top 10' then '10'
When 'Top 15' then '15'
When 'Top 20' then '20'
When 'Top 25' then '25'
Else 'All'
end

CognosPaul

When using a prompt macro you don't need the question marks. Get rid of those and try again.