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?
我有两个报表参数,在我创建关联数据集时自动设置。它们是ReportID和CompanyID。用户从列表框中选择公司名称,从另一个列表框中选择报告名称。标准SELECT ID,Name FROM TableName查询用于填充相应的列表框。报告参数工作正常,报告正确显示。我的问题是这个。我想将选定的报告名称和公司名称放在报告标题中(这些是用户在点击查看报告按钮之前从下拉列表中选择的名称值。我设置了两个新参数,ReportName和CompanyName;标记它们是隐藏的并将其默认值设置为适当的数据集。问题是标题始终显示列表中的第一个名称,而不是用户选择的名称。我的问题是,如何将选定的信息放入标题中?
5 个解决方案
#1
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:
在我的报告中,我有一个“Farm”参数,该参数由“SELECT FarmNumber,FarmName FROM Farms”查询填充。用户从ComboBox中选择他想要的服务器场。我使用以下表达式在报告的标题中显示所选的服务器场:
=Parameters!Farm.Label
"Label" is the "display text" (FarmName in this case) for the farm that the user selected.
“Label”是用户选择的服务器场的“显示文本”(在本例中为FarmName)。
#2
Doesn't throwing in Parameters!ReportID.Value into a textbox in the header work?
是不是将参数!ReportID.Value抛入标题工作的文本框中?
From what it sounds like, you should use whatever the original Parameter is named in the 'ReportID' spot.
从它的声音来看,你应该使用在'ReportID'点中命名的原始参数。
#3
If CompanyID is a multi-value parameter, this will work:
如果CompanyID是一个多值参数,这将起作用:
=Join(Parameters!CompanyIDs.Label,System.Environment.NewLine)
#4
With SSRS 2008 R2, I had a header with multiple parameters:
使用SSRS 2008 R2,我有一个包含多个参数的标头:
My Export for [@ReportDate] [@AccountId.Label]
#5
=Parameters!Farm.value
replace value with Label
用Label替换值
=Parameters!Farm.Label
#1
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:
在我的报告中,我有一个“Farm”参数,该参数由“SELECT FarmNumber,FarmName FROM Farms”查询填充。用户从ComboBox中选择他想要的服务器场。我使用以下表达式在报告的标题中显示所选的服务器场:
=Parameters!Farm.Label
"Label" is the "display text" (FarmName in this case) for the farm that the user selected.
“Label”是用户选择的服务器场的“显示文本”(在本例中为FarmName)。
#2
Doesn't throwing in Parameters!ReportID.Value into a textbox in the header work?
是不是将参数!ReportID.Value抛入标题工作的文本框中?
From what it sounds like, you should use whatever the original Parameter is named in the 'ReportID' spot.
从它的声音来看,你应该使用在'ReportID'点中命名的原始参数。
#3
If CompanyID is a multi-value parameter, this will work:
如果CompanyID是一个多值参数,这将起作用:
=Join(Parameters!CompanyIDs.Label,System.Environment.NewLine)
#4
With SSRS 2008 R2, I had a header with multiple parameters:
使用SSRS 2008 R2,我有一个包含多个参数的标头:
My Export for [@ReportDate] [@AccountId.Label]
#5
=Parameters!Farm.value
replace value with Label
用Label替换值
=Parameters!Farm.Label