首先找到Ribbon菜单中的Data Source,而后单击它下面的Parameters,如图:编辑器
在弹出的对话框中单击Add添加新参数:spa
指定如下设置:code
Settings | Description | API |
---|---|---|
Name | 指定参数名 | Parameter.Name |
Value | 指定参数值 | Parameter.Value |
Type | 指定参数类型 | Parameter.Type |
LookUpSettings | 指定参数查询编辑器设置 | DashboardParameter.LookUpSettings |
Description | 指定展现给最终用户的参数描述 | DashboardParameter.Description |
Visible | 指定在Dashboard Parameters对话框中参数编辑器是否可见 | DashboardParameter.Visible |
最后单击OK表示肯定。ip
查询编辑器设置有三种方式(以下图)。从LookUpSettings下拉列表中能够选择你须要的类型:string
No Look-Up - Value使用一个静态值做为参数io
StaticList - 单击省略号按钮为当前的仪表盘参数添加静态值:table
这样Value就指定了默认的参数值。class
DynamicList - 从当前的数据源中选择一系列的值。选择须要的DataSource,还有仪表盘参数显示名和值所需的数据元素:List
仪表盘提供 Dashboard.Parameters 属性,它用于访问仪表盘参数。下面介绍一下如何用代码来建立参数。im
首先,用查询编辑器设置(DashboardParameter.LookUpSettings属性)建立一个参数,而后将它添加到仪表盘的参数当中。参考代码以下:
No Look-Up:
DashboardParameter parameter1 = new DashboardParameter("Parameter1", typeof(string), "Beverages", "", true, null);
StaticLis - 使用 StaticListLookUpSettings.Values 属性去访问仪表盘参数的静态值:
StaticListLookUpSettings settings = new StaticListLookUpSettings(); settings.Values = new string[] {"Beverages", "Condiments"}; DashboardParameter parameter2 = new DashboardParameter("Parameter2", typeof(string), "Beverages", "", true, settings);
DynamicList - 使用 DynamicListLookUpSettings.DataSource 属性指定仪表盘参数所需的数据源。DynamicListLookUpSettings.ValueMember和DynamicListLookUpSettings.DisplayMember能够指定参数值的数据元素。
DynamicListLookUpSettings settings = new DynamicListLookUpSettings(); settings.DataSource = ds; settings.ValueMember = "CategoryName"; settings.DisplayMember = "CategoryName"; DashboardParameter parameter3 = new DashboardParameter("Parameter3", typeof(string), "Beverages", "", true, settings);