DataItem.UniqueId Property

Gets or sets the unique data item identifier.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v21.2.Core.dll

Declaration

public string UniqueId { get; set; }

Property Value

Type Description
String

A String that specifies the data item identifier.

Remarks

The UniqueId property returns null for the newly created data item. If you add the created DataItem to a data-bound dashboard item (DataDashboardItem), the UniqueId will return an auto-generated identifier (DataIem0, DataItem1, etc.), which is unique inside a dashboard item.

You can use the value returned by the UniqueId property to identify the data item in the following cases:

Important

If you specified a custom data item identifier, make sure that its value is unique inside a dashboard item. Otherwise, DuplicateDataItemIdException will be thrown.

Example

The following example demonstrates how to create a new dashboard parameter and pass it to a dashboard item filter string.

In this example, the dashboard data source contains two queries - the SalesPerson query is used for data visualization while the Categories query provides values for the dashboard parameter.

After the dashboard parameter is created, it is passed to a dashboard item’s filter strings. So, the dashboard displays data according to the selected values.

View Example

using DevExpress.XtraEditors;
using DevExpress.DashboardCommon;

namespace Dashboard_Parameters {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
            Dashboard dashboard = new Dashboard();
            dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");

            // Obtain dashboard items and specify identifiers for data items.
            GridDashboardItem grid = (GridDashboardItem)dashboard.Items[0];
            PieDashboardItem pie = (PieDashboardItem)dashboard.Items[1];  
            ((GridDimensionColumn)grid.Columns[0]).Dimension.UniqueId = "categoryColumn";
            pie.SeriesDimensions[0].UniqueId = "categorySeries";

            // Obtain the dashboard data source used to provide parameter values.
            DashboardSqlDataSource parameterDataSource = 
                (DashboardSqlDataSource)dashboard.DataSources[0];

            // Create a new parameter that obtains its values from the Categories query.
            DynamicListLookUpSettings settings = new DynamicListLookUpSettings();
            settings.DataSource = parameterDataSource;
            settings.DataMember = "Categories";
            settings.ValueMember = "CategoryName";
            DashboardParameter parameter = new DashboardParameter("categoryParameter", 
                typeof(string), "Beverages", "Select categories:", true, settings);
            // Enable multi-selection for the created parameter.
            parameter.AllowMultiselect = true;

            // Add the created parameter to a collection of dashboard parameters.
            dashboard.Parameters.Add(parameter);

            // Include the created parameter in filter strings as an operand value.
            grid.FilterString = "categoryColumn in (?categoryParameter)";
            pie.FilterString = "categorySeries in (?categoryParameter)";

            dashboardViewer1.Dashboard = dashboard;
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the UniqueId property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also