views:

2169

answers:

4

I have a SQL 2005 Reporting Services report that has several report parameters. One of them is called IsActive and is of type Boolean. The parameter is hidden and set to allow null values. For its default values settings, I have it set to null. In my application that has the reportviewer control, I have logic that decided whether or not to set this parameter to a value (true or false). There are conditions that require it to be not set at all. For some reason, if I do not pass a value, the parameter defaults to TRUE. It operates fine when a value is passed. Is my problem stemming from the simple reason that it is a Boolean parameter? Would changing it to a string be better?

Thanks!

A: 

You pretty much answer the question yourself.

Boolean is True or False, If you need True, False and NULL you might want to use another type like string

UndertheFold
True, False and NULL are valid values for a NULLable Boolean. You shouldn't use string where all you need is TRUE, FALSE and NULL.
Orion Adrian
+1  A: 

Changing it to a string is only necessary if there's no way to get it to take the NULL value because of a bug or "feature".

Orion Adrian
A: 

IIf(IsNothing(Fields!BooleanField.Value) , "-- Any --" , IIf(Fields!BooleanField.Value = True , "Yes" , "No"))

VEXIT.COM
A: 

Don't know if this is related...

I had a problem where I could not get the default value to be selected when viewing the report from outside of the BIDS after making changes to the report.

It turned out that the parameter settings was not updated when deploying the report.

Changing the settings manually via the Report Manager or removing and re-deploying the report solved the problem.

Henrik Johansson