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
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]
this is the error i keep getting: Parsing error before or near position: 77 of: "case
when (?Parameter?) = 'Yes'
then [Data Item] ="
Also replace
then [Data Item] = 'Yes'
with
then 'Yes'
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
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?