Reporting Services: How to place a report parameter in the header
Asked Answered
D

6

12

I have two report parameters that were set up automatically when I created their associated datasets. They are ReportID and CompanyID. The user selects a Company Name from a list box and a Report Name from another list box. The standard SELECT ID, Name FROM TableName query was used to fill the respective list boxes. The report parameters work just fine and the report is displayed properly. My problem is this. I would like to place the selected Report Name and the Company Name in the report header (these are the Name values the user selected from the dropdown lists just before hitting the View Report button. I set up two new parameters, ReportName and CompanyName; marked them as hidden and set their default values to the appropriate datasets. The problem is that the header always shows the first name from the list, not the name the user selected. My question is, how do I place the selected information into the header?

Darlington answered 29/12, 2008 at 21:53 Comment(1)
why did you set up two new parameters? why didn't the ones that were auto-created work?Neocene
S
23

I've had no problem doing this with the original set of parameters that are populated from a query.

In my reports I have a "Farm" parameter which is populated by a "SELECT FarmNumber, FarmName FROM Farms" query. The user selects the farm he wants from a ComboBox. I show the selected farm in the header of the report using this expression:

=Parameters!Farm.Label

"Label" is the "display text" (FarmName in this case) for the farm that the user selected.

Selenium answered 29/12, 2008 at 22:2 Comment(2)
Many thanks. I thought it should be something simple like that. I just need to get a better handle on all of the availalbe properties. Again, thanks for the help.Darlington
FYI, for a date parameter, if you don't want the time portion to show, it may work better to use the Value property instead of the Label property. For example, replacing =Parameters!StartDate.Label with =Parameters!StartDate.Value. Then, if the time portion is set to midnight, it won't show.Zygoma
N
3

Doesn't throwing in Parameters!ReportID.Value into a textbox in the header work?

From what it sounds like, you should use whatever the original Parameter is named in the 'ReportID' spot.

Neocene answered 29/12, 2008 at 21:58 Comment(0)
A
2

With SSRS 2008 R2, I had a header with multiple parameters:

My Export for [@ReportDate] [@AccountId.Label]
Affirm answered 22/2, 2013 at 17:54 Comment(0)
C
2

If CompanyID is a multi-value parameter, this will work:

 =Join(Parameters!CompanyIDs.Label,System.Environment.NewLine)
Cruller answered 10/6, 2013 at 18:44 Comment(0)
T
0

=Parameters!Farm.value

replace value with Label

=Parameters!Farm.Label

Thrave answered 18/5, 2015 at 11:13 Comment(0)
S
0

How exactly are you adding your command to the header? My failed attempt to show my parms was[email protected] and it dislayed as text, not the value of the parameter. I had to right click the text and then add an expression from the Parameters list and it gave me the syntax that I needed.

Snapback answered 7/2 at 23:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.