SQL Server Performance

Multiple Selection

Discussion in 'SQL Server Reporting Services' started by brian13, Aug 24, 2004.

  1. brian13 New Member

    Hello all,

    Is it possible to have a multi-select list/box? I am creating a report where I would like to allow the user to select multiple facilities for which I will provide information. If this is not possible, are there any suggestions to accomplish this? Is it possible for me to request this information in an asp.net application and pass these values to the report?

    Any help would be greatly appreciated!

  2. abhiinbwir New Member


    It is not possible to go for Multiple select in Reporting Services but you can create your own interface in ASP.Net, ASP or even in HTML and pass the values to Reporting services.

    -- Abhishek
  3. mlapoint New Member

    Another option is that you could create a Stored Procedure that accepts an String input parameter. You could have the users free-hand type a comma delimited list of values and have that passed into the Stored Procedure where it is parsed into a proper IN list.

    I haven't tried it yet but it is probably what we are going to have to do.
  4. mlapoint New Member

    Eureka! Ok, I didn't solve the "multiple selctions" thing but I DID figure out how to use IN Lists if someone types in a comma separated list of values into a free text developer.

    1) Place this piece of Custom Code to put in the report:

    public function InValue(InString as String, _
    Optional InType as String = "S", _
    Optional InDelim as String = ",")

    ' Author: Mike La Pointe
    ' Date: 10/01/2004
    ' Descr: Accepts a delimited value and returns
    ' a quoted delimited value

    Dim newString
    Dim delim = "'"

    if InType = "N" then
    delim = ""
    end if

    newString = delim _
    + join(split(InString,InDelim), delim + "," + delim ) _
    + delim

    return newString

    end Function

    2) Build a simple query as follows in the Generic Query Builder and execute it to the fields:

    select * from <table>

    3) Build a parameter (I call it MyParam in this example)

    4) Change the query to the following:

    ="select * from <table> where <field> in ( " + Code.InValue(Parameters!MyParam.Value) + ")"

    5) Run the Query:
    Comma is the standard delimiter to pass into the query but others can be used (3rd optional parameter)

Share This Page