Wednesday, March 28, 2012

Multi Parameter with Boolean Field

Hello,

Can anyone say me how i can make a Report with Parameter Boolean field,and as Default Value true and False. ( Both ).

With Multivalue and in the Query = Field in (@.BoolPara) have i a Error in the Query.

Thanks

Hi,

It is not possible to have a Both clause by default. Although, here is a workarround:

In case of using a Bool report parameter, I use an integer report parameter and set its available values as follow:
Both -1
True 1
False 0

Defaultvalues: 1

In the were clause set the format as below:
SELECT *
FROM SampleBoolTable
WHERE (BoolCol = ABS(@.BoolParameter) OR @.BoolParameter = -1)

So when you now render your report, you will see the options True, False and Both. When selecting Both, a dummy filter is used so everything is shown.

NOTE: The ABS function is necessary to avoid the comparison between -1 and a BIT column.

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

No comments:

Post a Comment