Dashboard
Dashboard Client Settings
DRevealDashboardClientSettings is a configuration class designed to help users customize the behavior of dReveal Dashboards in test automation or integration scenarios. This class provides support for loading dashboards, applying filters and parameters, customizing chart views, and exporting data.
This class defines all necessary properties and methods required to connect to a database, load a dReveal .dDashX dashboard, apply filters or parameters, control chart behavior, and configure export options. It supports saving user preferences and customizing chart component states.
Properties
| Name | Type | Description |
|---|---|---|
| ConnectionString | string | Defines the database connection string used to retrieve data from the source. Default value: null |
| File | MemoryStream | The DReveal Dashboard file .dDashX loaded as a memory stream. Default value: null |
| UserDefinedParameters | ICollection<DRevealParameter> | A collection of input parameters defined by the user, used to filter or modify the dashboard's data queries. Default value: null |
| FileName | string | The name of the .dDashX dashboard file. This is a required property. Default value: null |
| Filters | ICollection<IFilter> | List of filter conditions to be applied to the dashboard data before rendering. Default value: null |
| StrictMode | bool | This property allows the execution of a Dashboard regardless its design when set as false, when the value is set in true and the report has required filters, no Dashboard execution is able without adding that information through the client settings. Default value: false |
| ExportingFolderPath | string | Defines the folder path where exported files will be saved. Default value: empty |
| ExportFileName | string | The name of the file that will be generated when the dashboard is exported. Default value: empty |
| IsSaveStateAction | bool | If true, enables the system to save the dashboard’s current UI or state preferences. Default value: false |
| UserCustomization | string | Stores user-defined layout or state settings for the dashboard. Default value: null |
| DrillThroughParameters | string | Encrypted string that contains drill-through behavior parameters. Default value: null |
| ItemStateSetting | DashboardStateSetting | Represents the state of individual dashboard items (e.g., charts, grids), useful for restoring layouts. Default value: null |
| EnabledPivotExportExcelObject | bool | When enabled, allows pivot tables or objects to be exported as Excel-compatible formats. Default value: false |
Chart Configuration Methods
These methods allow dynamic customization of dashboard chart components.
| Name | Type | Parameters | Description |
|---|---|---|---|
| Swap | void | string componentName | Performs swap action of the component given. |
| ExistChartSetting | bool | NA | true if chart settings is different null, otherwise is false |
| GetChartSettings | ICollection<DRevealChartSetting> | NA | Get the chart settings |
| SetAxisYAndSeries | void | 1. string componentName 2. string axisY 3. string series | Set a chart with axis Y (Argument) and Series (Series) |
| SetAxisY | void | 1. string componentName 2. string axisY | Sets or updates the Y-axis label (Argument) for a chart component. |
| SetSeries | void | 1. string componentName 2. string series | Sets or updates the data series for a chart component. |
Methods
GetDRevealDashboardResult
Gets the dReveal dashboard result using the provided client settings. It receives a DRevealDashboardClientSettings object and retrieves a DRevealDashboardResult object with the final result containing charts, dataChartItems and the dataSet
Definition
public static DRevealDashboardResult GetDRevealDashboardResult(DRevealDashboardClientSettings dashboardClientSettings)
Usage Example
[TestMethod]
public void GetDashboardResult()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Sales By Customer.dDashX"; //Replace this variable with your dashboard report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";
DRevealDashboardClientSettings dRevealDashboardClientSettings = new DRevealDashboardClientSettings()
{
ConnectionString = connectionString,
File = GetStream(filePath),
FileName = fileName,
};
DRevealDashboardResult dRevealDashboardResult = InfoArch.Common.DataExtraction.Helper.DRevealDashboardHelper.GetDRevealDashboardResult(dRevealDashboardClientSettings);
Assert.IsNotNull(dRevealDashboardResult, "The DRevealDashboardResult should not be null.");
}
ExportToExcel
Exports the dashboard data to an Excel XL file format using the provided DRevealDashboardClientSettings client settings.
Definition
public static void ExportToExcel(DRevealDashboardClientSettings dashboardClientSettings)
Usage Example
[TestMethod]
public void ExportDashboardToExcelXL()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Sales By Customer.dDashX"; //Replace this variable with your dashboard report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";
DRevealDashboardClientSettings dRevealDashboardClientSettings = new DRevealDashboardClientSettings()
{
ConnectionString = connectionString,
File = GetStream(filePath),
FileName = fileName,
ExportFileName = "ExportedDashboardData",
ExportingFolderPath = sharedFolderPath,
};
InfoArch.Common.DataExtraction.Helper.DRevealDashboardHelper.ExportToExcel(dRevealDashboardClientSettings);
string exportedFilePath = dRevealDashboardClientSettings.ExportingFolderPath + "\\" + dRevealDashboardClientSettings.ExportFileName + ".xlsx";
Assert.IsTrue(File.Exists(exportedFilePath), "The exported Excel file should exist.");
File.Delete(exportedFilePath);
}
GetMetadata
Retrieves the metadata of a dashboard using the DRevealDashboardClientSettings client settings, including filters and dashboard item configurations and returns a DRevealDashboardMetadata structure for the dashboard, it means, DashboardItems, Filters and Views.
Definition
public static DRevealDashboardMetadata GetMetadata(DRevealDashboardClientSettings dashboardClientSettings)
Usage Example
[TestMethod]
public void GetDashboardMetadata()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Sales By Customer.dDashX"; //Replace this variable with your dashboard report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";
DRevealDashboardClientSettings dRevealDashboardClientSettings = new DRevealDashboardClientSettings()
{
ConnectionString = connectionString,
File = GetStream(filePath),
FileName = fileName,
};
DRevealDashboardMetadata dashboardMetadata = InfoArch.Common.DataExtraction.Helper.DRevealDashboardHelper.GetMetadata(dRevealDashboardClientSettings);
Assert.IsNotNull(dashboardMetadata, "The DRevealDashboardMetadata should not be null.");
}
GetMetadata (Overload)
Retrieves the metadata of a dashboard using the DRevealDashboardClientSettings client settings, including filters and dashboard item configurations and returns a DRevealDashboardMetadata structure for the dashboard, it means, DashboardItems, Filters and Views.
Definition
public static DRevealDashboardMetadata GetMetadata(MemoryStream modelStream, string connectionString, ICollection<Parameter.DRevealParameter> parameters)
Usage Example
//Method to add a user defined parameter "Culture" to the dRevealDashboardClientSettings
private List<DRevealParameter> GetUserDefinedCultureParameter()
{
return new List<DRevealParameter>()
{
new DRevealParameter() { Name = "Culture", Value = Thread.CurrentThread.CurrentUICulture.Name, DataType = DataType.String }
};
}
[TestMethod]
public void GetDashboardMetadataOverloaded()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Sales By Customer.dDashX"; //Replace this variable with your dashboard report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";
DRevealDashboardClientSettings dRevealDashboardClientSettings = new DRevealDashboardClientSettings()
{
ConnectionString = connectionString,
FileName = fileName,
File = GetStream(filePath),
UserDefinedParameters = GetUserDefinedCultureParameter(),
};
dRevealDashboardClientSettings.UserDefinedParameters.First(x => x.Name == "Culture").Value = "zh-CN";
DRevealDashboardMetadata dashboardMetadata = InfoArch.Common.DataExtraction.Helper.DRevealDashboardHelper.GetMetadata(dRevealDashboardClientSettings.File, dRevealDashboardClientSettings.ConnectionString, dRevealDashboardClientSettings.UserDefinedParameters);
Assert.IsNotNull(dashboardMetadata, "The DRevealDashboardMetadata should not be null.");
}
EncryptDrillThroughParameters
Encrypts a DataDrillThrough data structure to a secure string format for safe transmission between reports.
Definition
public static string EncryptDrillThroughParameters(DataDrillThrough dataDrillThrough)
Usage Example
The AddDrillThroughParametersToGrid method constructs and returns a fully populated DataDrillThrough object, which contains all the necessary drill-through configuration to connect a dashboard component to a grid-based report. This allows users to click on a chart or segment in the dashboard and drill down into detailed tabular data related to the selected values.
This method dynamically builds argument/series values and filters based on the provided dashboard settings.
Needed Library:
using InfoArch.Common.Core.Structures.Dashboard;
Method:
public static DataDrillThrough AddDrillThroughParametersToGrid(DRevealDashboardClientSettings dashboardClientSettings, Boolean isSegment)
{
DataDrillThrough dataDrillThrough = new DataDrillThrough();
//Useful for dashboards with Master Filters
dataDrillThrough.MasterFilters = new List<SelectedDimension>
{
new SelectedDimension { DataMember = "{dataMember3}", SelectedValue = "{selectedValue3}" },
new SelectedDimension { DataMember = "{dataMember4}", SelectedValue = "{selectedValue4}" }
};
if (isSegment)
{
dataDrillThrough.ArgumentObjectData = new ArgumentDataDrillThrough { DataMember = "OrderYear", IsCalculatedField = true, SelectedValue = "2013" }; //OrderYear value got from DATA ITEMS form in dashboard designer
dataDrillThrough.SerieObjectData = new SerieDataDrillThrough { DataMember = "Education", IsCalculatedField = true, SelectedValue = "Bachelors" }; //Education value got from DATA ITEMS form in dashboard designer
}
dataDrillThrough.FilterConditions = DRevealDashboardHelper.GetFiltersConditions(dashboardClientSettings);
dataDrillThrough.Filters = DRevealDashboardHelper.GetFilters(dashboardClientSettings);
return dataDrillThrough;
}
Then use the dataDrillThrough object as following:
DataDrillThrough queryStringParameters = dataDrillThrough;
string drillThroughGridParameters = DRevealDashboardHelper.EncryptDrillThroughParameters(queryStringParameters);
GetFiltersConditions
Retrieves the filter condition rules from the configured dReveal dashboard using the DRevealDashboardClientSettings.
Definition
public static List<ConditionItem> GetFiltersConditions(DRevealDashboardClientSettings clientSettings)
Usage Example
DataDrillThrough dataDrillThrough = new DataDrillThrough();
dataDrillThrough.FilterConditions = DRevealDashboardHelper.GetFiltersConditions(dashboardClientSettings);
GetFilters
Method that obtains the Filters from DReveal dashboard using the DRevealDashboardClientSettings.
Definition
public static DataSourceFilters GetFilters(DRevealDashboardClientSettings dashboardClientSettings)
Filter Configuration Usage Example
Create a GetDashboardFilterToAdd helper method in order to get the filter as IFilter to add into the client settings:
Libraries needed for the method:
using InfoArch.Common.DataExtraction.Helper;
using InfoArch.Common.Core.Structures.Filters;
using System.Linq;
using System;
Helper method:
private static IFilter GetDashboardFilterToAdd(string filterName, string filterValueToFind, DRevealDashboardClientSettings dashboardClientSettings)
{
var availableFilterValueList = FilterHelper.GetFilterValuesFromDashboard(filterName, dashboardClientSettings);
var filterValue = availableFilterValueList.FirstOrDefault(filter => filter.Label.Equals(filterValueToFind, StringComparison.OrdinalIgnoreCase));
return FilterHelper.GetFilter(filterName, filterValue);
}
The user can use the GetDashboardFilterToAdd method in order to add filters in the client settings as follow:
[TestMethod]
public void GetDashboardResultWithFilter()
{
string connectionString = ConfigurationManager.AppSettings["ConnectionString"];
string fileName = "Sales By Customer dReveal Learn DataExtraction.dDashX"; //Replace this variable with your dashboard report name.
string sharedFolderPath = ConfigurationManager.AppSettings["SharedFolderPath"];
string filePath = $"{sharedFolderPath}\\{fileName}";
DRevealDashboardClientSettings dRevealDashboardClientSettings = new DRevealDashboardClientSettings()
{
ConnectionString = connectionString,
File = GetStream(filePath),
FileName = fileName,
};
string filterName = "Customer"; //filterName value is obtained from the dashboard designer in the Filtering Option form.
string filterValueToFind = "Aimee Gao"; //filterValueToFind value is obtained from DataBase.
IFilter filterToAdd = GetDashboardFilterToAdd(filterName, filterValueToFind, dRevealDashboardClientSettings);
dRevealDashboardClientSettings.Filters = new List<IFilter>() { filterToAdd };
DRevealDashboardResult dRevealDashboardResult = InfoArch.Common.DataExtraction.Helper.DRevealDashboardHelper.GetDRevealDashboardResult(dRevealDashboardClientSettings);
Assert.IsNotNull(dRevealDashboardResult, "The DRevealDashboardResult should not be null.");
}