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

IF Else Statement on Parameter

Started by et21, 12 Jul 2022 05:50:39 PM

Previous topic - Next topic

et21

Hi all i recently tried to use if statement on my parameter but somehow its always give me error no matter what I change. I even tried case as well but somehow its got the same error.

case
when (?Parameter?) = 'Yes'
then [Data Item] = 'Yes'
else then [Data Item]
end

Can someone point out my mistake please

bus_pass_man

Here is the syntax of a case function.

case
when [country] = 'canada' then ([list price] * 0.60)
when [countrycode] > 100 then [list price] * 0.80
else [list price]
end

In general some information which could help troubleshooting include:
What does the error message say? What changes do you make?   Are there any variations in what the error messages say?

I think you need to remove the then after the else.   [/list][/list][/list]

et21

this is the error i keep getting:  Parsing error before or near position: 77 of: "case
when (?Parameter?) = 'Yes'
then [Data Item] ="

bus_pass_man


Also replace
then [Data Item] = 'Yes'
with
then 'Yes'

BigChris

Ok, it looks like you're trying to use that in a filter. Instead of
case
when (?Parameter?) = 'Yes'
then [Data Item] = 'Yes'
else then [Data Item]
end


You probably want something more like:
(?Parameter? = 'Yes' and [Data Item] = 'Yes') or [Data Item] <> 'Yes'
You might need to tweak the OR part to give you the data that you're looking for

et21

Yes I tried to use if statement on the filter. is there any way I can use if statement on parameter in the filter section?