Creating a boolean select box in an SSRS Report.

I’m currently working on porting a large legacy classic asp application to asp.net. The classic asp application contains "reports" written in classic asp, so I’m porting that report section into SQL Server Reporting Services (SSRS 2008). One of the "reports" I encountered contained a SELECT statement such as the following.

dim sql
sql = "SELECT * FROM TABLE "

if condition = "True" then
     sql = sql & " WHERE (MyBoolean = 1)"
end if
if condition = "False" then
     sql = sql & " WHERE (MyBoolean = 0)"
end if

In this particular query, "condition" can also contain a value for "True or False" where all records are selected. I’m still a novice to Sql Server Reporting Services so I was not sure how to handle this issue. If I create a boolean parameter in my report, I get a set of radio buttons that I could not configure. The following method would not work:

The not-working parameter setup:



The unwanted result:



I looked on the web for creating a Boolean parameter select box with no luck, so I came up with this solution. I first had to ditch the idea of using the Boolean parameter. Then I figured, why not just treat this parameter as an integer rather than a Boolean?

First, set your integer parameter as follows. If you want a value for "True or False" (aka "All Records"), make sure you check you check the "Allow multiple values" checkbox.



Next, setup your default values as follows:



The result:



I’m not sure is this method will work with other databases other than SQL Server, but maybe it will. Happy reporting.

Tags: ,
Categories: SSRS | SQL Server Reporting Services

Permalink E-mail | Kick it! | DZone it! | del.icio.us Comments (14) Post RSSRSS comment feed

Comments

8/19/2010 6:47:05 PM #

wow gold

I really enjoyed reading through this write-up. I most certainly will be coming back to read some more intriguing ideas. Thank you.<br />http://www.wowgoldsale.nl/

wow gold Taiwan

8/19/2010 7:26:34 PM #

pearl necklace

Brilliant stuff, man!  What you have to say is really important and Im glad you took the time to share it.  What you said really spoke to me and I hope that I can learn more about this.  Thanks for sharing your opinion.  I am yet to find anything as enlightening as this on the web.<br />http://www.pearlnecklace-online.com/

pearl necklace Albania

8/19/2010 8:27:02 PM #

tiffany jewellery

was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.<br />http://www.tiffanyjewellerysaler.com/

tiffany jewellery Ukraine

8/20/2010 9:38:37 PM #

First Person Shooting

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.<br />http://www.small-game-online.com

First Person Shooting Uzbekistan

8/20/2010 10:24:00 PM #

wow gold

Thanks for the nice blog. This is the most incredible post I have read in a very long time. Thanks<br />http://www.wowgold-dk.com/

wow gold Russia

8/28/2010 6:01:48 AM #

Jordan 1

I undoubtedly experiencing every tiny bit of it and I have you bookmarked to take a look at brand new things your post. Thanks for sharing!

Jordan 1 United Kingdom

8/28/2010 6:21:51 PM #

ff14 gil

Great post! You really know what you're talking about. I'm subscribing for future updates. If you're looking to try out the hcg diet visit my website.<br />http://www.ffxivgil-ff14gil.com/

ff14 gil Indonesia

8/31/2010 8:32:47 AM #

shirts armani

Thanks for such a great post and the review, I am totally impressed! Keep stuff like this coming.

shirts armani United States

8/31/2010 8:39:48 AM #

wholesale oakley sunglasses

I have get a lot of useful information and fresh knowledge in your website.

wholesale oakley sunglasses United States

9/3/2010 12:15:13 PM #

flowers delivery in delhi

Nice effort, very informative, this will help me to complete my task.I really like flowers and also interested to send flowers all over the world.......

flowers delivery in delhi

9/5/2010 2:02:01 PM #

wow items

I wonder how you got so good.  HaHa!  This is really a fascinating blog, lots of stuff that I can get into.  One thing I just want to say is that your design is so perfect!  You certainly know how to get a girls attention!  Im glad that youre here.  I feel like Ive learned something new by being here.<br />http://www.wowitem365.com/

wow items India

9/5/2010 3:09:47 PM #

gold jewelry

Super-Duper site! I am loving it!! Will come back again �C taking you feeds also, Regards<br />http://www.goldjewelry365.com/

gold jewelry Spain

9/6/2010 8:02:45 AM #

miu miu handbags

Thank you for sharing

miu miu handbags United States

9/6/2010 8:07:27 AM #

opal earrings

Thank you for sharing

opal earrings United States

Add comment


(Will show your Gravatar icon)
  Country flag

biuquote
  • Comment
  • Preview
Loading