Dave Loeb
Dave Loeb

Reputation:

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

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?

Upvotes: 12

Views: 48224

Answers (6)

FarmBoy
FarmBoy

Reputation: 11

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.

Upvotes: 0

jamal ahmad
jamal ahmad

Reputation: 1

=Parameters!Farm.value

replace value with Label

=Parameters!Farm.Label

Upvotes: 0

FMFF
FMFF

Reputation: 1718

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

 =Join(Parameters!CompanyIDs.Label,System.Environment.NewLine)

Upvotes: 2

Darren Griffith
Darren Griffith

Reputation: 3460

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

My Export for [@ReportDate] [@AccountId.Label]

Upvotes: 2

Matt Hamilton
Matt Hamilton

Reputation: 204219

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.

Upvotes: 23

Dano
Dano

Reputation: 667

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.

Upvotes: 3

Related Questions