Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Multiple selection from drop down?

Author  Topic 

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-04-18 : 12:32:37
I'm wondering if there's a way to set it so that users can select multiple items from a drop down list. At this point, I'm just able to select from 1 item and that's it. Anyone able to get it so that users can select multiple items?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-18 : 12:52:16
That option isn't available in the current version. You would need to have your application do this for you and pass a CSV list to the report where the stored procedure can handle this. As I recall, you don't have an application wrapped around your reports though, so you don't have this alternative available.

Tara
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-18 : 13:29:17
Chris,

You still don't have to do this in your application. What you can do is instead of a combo box you can have a text box in reporting services. The text entered into the text box could be your parameter. For instance, on the report properties have that text box with the label ("Enter values seperated by ',':"). This will at least help most of your users enter multiple values and seperate them via a ','. Then you can use the CSV list as a parameter to the report:

....
AND(@WBS IS NULL OR dbo.IssueWBSElements.WBS IN (SELECT IntValue FROM dbo.CsvToInt(@WBS)))

And CsvToInt:

CREATE Function dbo.CsvToInt ( @Array varchar(1000))
returns @IntTable table
(IntValue int)
--Parse comma seperated value parameters
--To be used in SELECT blah WHERE blah IN (...)
--This function returns int, but may be modified to return any datatype
AS
begin

declare @separator char(1)
set @separator = ','

declare @separator_position int
declare @array_value varchar(1000)

set @array = @array + ','

while patindex('%,%' , @array) <> 0
begin

select @separator_position = patindex('%,%' , @array)
select @array_value = left(@array, @separator_position - 1)

Insert @IntTable
Values (Cast(@array_value as int))

select @array = stuff(@array, 1, @separator_position, '')
end

return
end


Thanks to nr for posting the CSVToInt procedure...


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-18 : 13:42:28
Holy moly, have your users enter CSV lists! That would never get past our QA department.

Tara
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-18 : 15:13:23
There is essentially 5-10 values they can select from. Plus my front end displays what the values could be entered as. I know some people have 100's of thousands of records but my point to chris was it is still possible to do with Reporting Services. Just isn't a combobox it becomes a text box.




Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

chriskhan2000
Aged Yak Warrior

544 Posts

Posted - 2005-04-19 : 09:20:53
Thanks for the example Jeff. My combo box only has about 5 items so it would not be a problem.

One question I have it this line:

dbo.IssueWBSElements.WBS IN (SELECT IntValue FROM dbo.CsvToInt(@WBS)))

The "IssueWBSElements.WBS" is that part of RS? Or is that a stored procedure?
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-04-19 : 09:43:10
Chris,

My name is Jon not Jeff ;)...I can't cross join like that guy :).
Sorry for not being clear, but yes dont worry too much about the IssueWBSElements..thats just a table in my stored procedure.
You will replace that portion with your own stored procedure. What you will be adding is the (SELECT IntValue...) portion to your stored procedure.

Jon


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -