为报表参数添加、更改或删除默认值Add, Change, or Delete Default Values for a Report Parameter

创建报表参数后,您可以提供一个默认值列表。After you create a report parameter, you can provide a list of default values. 如果所有参数都有有效默认值,报表会在您第一次查看或预览它时自动运行。If all parameters have a valid default value, the report runs automatically when you first view or preview it.

报表参数可以是单值参数或多值参数。Report parameters can represent one value or multiple values. 对于单值参数,可以提供一个文字或表达式。For single values, you can provide a literal or expression. 对于多值参数,可以提供静态值列表或者来自报表数据集的列表。For multiple values, you can provide a static list or a list from a report dataset.

备注

在 SQL Server Data Tools 中,你可以在报表生成器和报表设计器中创建和修改分页报表定义 (.rdl) 文件。You can create and modify paginated report definition (.rdl) files in Report Builder and in Report Designer in SQL Server Data Tools. 每个创作环境提供了不同的方式来创建、打开和保存报表和相关项。Each authoring environment provides different ways to create, open, and save reports and related items.

在您发布某一报表后,您可以通过对报表服务器设置参数属性值,在报表创作工具中覆盖在报表中定义的默认值。After you publish a report, you can override the default values that you define in the report in the report authoring tool, by setting parameter property values on the report server. 您还可以通过创建链接报表,提供多组默认参数值。You can also provide multiple sets of default parameter values by creating linked reports. 有关详细信息,请参阅 报表参数(报表生成器和报表设计器)For more information, see Report Parameters (Report Builder and Report Designer)

添加或更改报表参数的默认值To add or change the default values for a report parameter

  1. 在“报表数据”窗格中,展开 “参数” 节点。In the Report Data pane, expand the Parameters node. 右键单击该参数,然后单击“编辑”。Right-click the parameter and click Edit. 此时将打开 “报表参数属性” 对话框。The Report Parameter Properties dialog box opens.

    备注

    如果“报表数据”窗格不可见,请单击“视图”,然后单击“报表数据” 。If the Report Data pane is not visible, click View and then click Report Data.

  2. 单击 “默认值”Click Default Values.

  3. 选择一个默认选项:Select a default option:

    • 若要手动提供一个值或值列表,请单击 “指定值”To manually provide a value or list of values, click Specify values. 单击 “添加” ,然后在 “值” 文本框中输入值。Click Add and then enter the value in the Value text box. 您可以为值编写表达式。You can write an expression for a value. 数据类型必须与参数的数据类型相匹配。The data type must match the data type of the parameter. 字段名称不能用于参数的表达式中。Field names cannot be used in an expression for a parameter.

      对于多值参数,对每个要提供的值重复此步骤。For multivalue parameters, repeat this step for as many values as you want to provide. 您在此列表中看到的项的顺序将决定用户在下拉列表中看到这些项的顺序。The order of items you see in this list determines the order that the user sees them in the drop-down list. 若要更改列表中某一项的顺序,单击 “值” 文本框选择该项,然后使用上箭头或下箭头按钮在列表中上下移动该项。To change the order of an item in the list, click the Value text box to select the item, and then use the up and down arrow buttons to move the item higher or lower in the list.

    • 若要提供检索值的现有数据集的名称,请单击 “从查询中获取值”To provide the name of an existing dataset that retrieves the values, click Get values from a query. “数据集” 中,选择该数据集的名称。In Dataset, choose the name of the dataset.

      “值字段” 中,选择提供参数值的字段的名称。In Value field, choose the name of the field that provides parameter values.

  4. 单击“确定”。 Click OK.

删除报表参数的默认值To remove the default values for a report parameter

  1. 在“报表数据”窗格中,展开 “参数” 节点。In the Report Data pane, expand the Parameters node. 右键单击该参数,然后单击“编辑”。Right-click the parameter and click Edit. 此时将打开 “报表参数属性” 对话框。The Report Parameter Properties dialog box opens.

  2. 单击 “默认值”Click Default Values.

  3. “选择以下选项之一” 中,单击 “无默认值”In Select from one of the following options, click No default value.

  4. 单击“确定”。 Click OK.

另请参阅See Also

报表参数(报表生成器和报表设计器) Report Parameters (Report Builder and Report Designer)
向报表添加级联参数(报表生成器和 SSRS) Add Cascading Parameters to a Report (Report Builder and SSRS)
教程:向报表添加参数(报表生成器) Tutorial: Add a Parameter to Your Report (Report Builder)
添加数据集筛选器、数据区域筛选器和组筛选器(报表生成器和 SSRS) Add Dataset Filters, Data Region Filters, and Group Filters (Report Builder and SSRS)
参数集合引用(报表生成器和 SSRS) Parameters Collection References (Report Builder and SSRS)
更改报表参数的顺序(报表生成器和 SSRS) Change the Order of a Report Parameter (Report Builder and SSRS)
添加、更改或删除报表参数(报表生成器和 SSRS) Add, Change, or Delete a Report Parameter (Report Builder and SSRS)
表达式(报表生成器和 SSRS)Expressions (Report Builder and SSRS)