Wednesday 29 October 2014

COGNOS: USING OPTIONAL PARAMETER IN A DATA ITEM WITH MACRO

Sometimes we may need to add a data item containing an expression with an optional parameter. In such case if we use simple ?Parameter_name? statement it will ask to enter parameter value at run time. For example, consider the below statement

case when ( ?p1? ='para1')
then
(
'PARA1'
)
else
(
'n/a'
)
end

The above statement will always make the optional parameter to required. To solve the issue we can use macro statement. For example the below statement will keep the optional prompt as optional only even when we are using it within a data item:


case (when #prompt('p1','string',"'dummy'")# ='para1')
then
(
'PARA1'
)
else
(
'n/a'
)
end

No comments:

Post a Comment