Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using multi-select Parameter values in a text box

Status
Not open for further replies.

SandeA

Technical User
Sep 5, 2019
5
US
I have a parameter where the user can select one or more options from a dropdown list of District Names, the value returns the District's code number. I want to then take whatever they selected and populate a text box at the top of the report. I already have some parameters on the report that I am using in text boxes (start and end date range values that the user inputs), and they work just fine, but they are single value.

First issue:
When I try the same in the expression as the date ranges with the multi-select parameter, only the code for the first District is returned. Is there a way to return multiple values?
Expression: =Parameters!DistrictCodes.Value(0)

Second issue:
I tried using Switch to convert the District Code to the District Name but even though I didn't receive any errors in the expression, when I ran the report, selected a District, only '#Error' appeared.

Thank you for any assistance!
Sande
 
I have a canned report from a vendor and they put the following code in the report (I have analyzed the code, so I can just tell you how it used).

Function ParameterList(ByVal Parameter As Object) As String
Dim sParamItem As Object
Dim sParamVal As String = ""

For Each sParamItem In Parameter
If sParamItem Is Nothing Then Exit For
sParamVal &= sParamItem & ", "
Next

Return sParamVal.SubString(0, sParamVal.Length - 2)
End Function

then called from an expression like this. =Code.ParameterList(Parameters!Offices.Value). So it looks like in your case you would replace the Parameters!Offices.Value with Parameters!DistrictCodes.Value.
 
Thank you, kray4660! I'll talk to the developer that wrote the stored procedure to see if he can add this. :)
 
The code would be embedded into the report. Right click on the report (make sure you get report properties), select Code, and enter the function above.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top