The requested page is not available for the requested platform. You are viewing the content for Default platform.

DashboardFederationDataSource Class

A federated data source that retrieves data from different data sources.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v19.1.Core.dll

Declaration

public class DashboardFederationDataSource :
    FederationDataSourceBase,
    IDashboardDataSource,
    IDashboardComponent,
    IComponent,
    IDisposable,
    ISupportInitialize,
    ISupportPrefix,
    IDashboardDataSourceInternal,
    ICloneable<DashboardFederationDataSource>,
    IAssignable<DashboardFederationDataSource>,
    IQueryDataSource<QueryNode>,
    IExternalSchemaConsumer
Public Class DashboardFederationDataSource
    Inherits FederationDataSourceBase
    Implements IDashboardDataSource,
               IDashboardComponent,
               IComponent,
               IDisposable,
               ISupportInitialize,
               ISupportPrefix,
               IDashboardDataSourceInternal,
               ICloneable(Of DashboardFederationDataSource),
               IAssignable(Of DashboardFederationDataSource),
               IQueryDataSource(Of QueryNode),
               IExternalSchemaConsumer

Remarks

The Federation Data Source integrates multiple data sources:

The Federation Data Source provides uniform access to multiple data sources and can be used as a regular Dashboard data source. You should create a DashboardFederationDataSource instance and add it to the Dashboard.DataSources collection.

The data source obtains its data from federated queries contained in the Queries collection.

Examples

Note

The complete sample project How to Bind a Dashboard to a Federated Data Source Created at Runtime is available in the DevExpress Examples repository.

using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.DataFederation;
using DevExpress.DataAccess.Excel;
using DevExpress.DataAccess.Sql;
// ...
DashboardFederationDataSource federatedDS = CreateFederatedDataSource(sqliteDataSource, exceldataSource, objectDataSource);
dashboard.DataSources.Add(federatedDS);

private static DashboardFederationDataSource CreateFederatedDataSource(DashboardSqlDataSource sqliteDataSource, DashboardExcelDataSource exceldataSource, DashboardObjectDataSource objectDataSource)
{
    DashboardFederationDataSource federationDS = new DashboardFederationDataSource();
    Source sqlSource = new Source("sqlite", sqliteDataSource, "SQLite Orders");
    Source excelSource = new Source("excel", exceldataSource, "");
    Source objectSource = new Source("SalesPersonDS", objectDataSource, "");

    #region Use-API-to-create-a-query
    SelectNode mainQueryCreatedByApi = new SelectNode();

    SourceNode excelSourceNode = new SourceNode(excelSource, "ExcelDS");
    SourceNode objectSourceNode = new SourceNode(objectSource, "ObjectDS");
    SourceNode sqliteSourceNode = new SourceNode(sqlSource, "SQLite Orders");

    mainQueryCreatedByApi.Alias = "FDS-Created-by-API";
    SourceNode root = new SourceNode(sqlSource, "SQLite Orders");
    mainQueryCreatedByApi.Root = root;
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "SalesPerson", Node = objectSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "Weight", Node = objectSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "CategoryName", Node = excelSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "ProductName", Node = excelSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "OrderDate", Node = sqliteSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "ShipCity", Node = sqliteSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "ShipCountry", Node = sqliteSourceNode });
    mainQueryCreatedByApi.Expressions.Add(new SelectColumnExpression() { Name = "Extended Price", Node = excelSourceNode });
    mainQueryCreatedByApi.SubNodes.Add(new JoinElement(excelSourceNode, JoinType.Inner, "[ExcelDS.OrderID] = [SQLite Orders.OrderID]"));
    mainQueryCreatedByApi.SubNodes.Add(new JoinElement(objectSourceNode, JoinType.Inner, "[ObjectDS.SalesPerson] = [ExcelDS.Sales Person]"));
    #endregion

    #region Use-NodedBuilder-to-create-a-query
    SelectNode mainQueryCreatedByNodeBuilder =
        sqlSource.From()
        .Select("OrderDate", "ShipCity", "ShipCountry")
        .Join(excelSource, "[excel.OrderID] = [sqlite.OrderID]")
            .Select("CategoryName", "ProductName", "Extended Price")
            .Join(objectSource, "[SalesPersonDS.SalesPerson] = [excel.Sales Person]")
                .Select("SalesPerson", "Weight")
                .Build("FDS-Created-by-NodeBulder");
    #endregion

    federationDS.Queries.Add(mainQueryCreatedByNodeBuilder);
    federationDS.Queries.Add(mainQueryCreatedByApi);

    federationDS.CalculatedFields.Add("FDS-Created-by-NodeBulder", "[Weight] * [Extended Price] / 100", "Score");

    federationDS.Fill(new DevExpress.Data.IParameter[0]);
    return federationDS;
}

Inheritance

Object
MarshalByRefObject
Component
DevExpress.DataAccess.DataComponentBase
FederationDataSourceBase
DashboardFederationDataSource

Implements

DevExpress.XtraPrinting.Native.IObject
DevExpress.Data.IParametersRenamer
DevExpress.DataAccess.Native.ISensitiveInfoContainer
DevExpress.DashboardCommon.Native.IDashboardComponent
DevExpress.DataAccess.Native.ISupportPrefix
DevExpress.DashboardCommon.Native.IDashboardDataSourceInternal
DevExpress.DashboardCommon.Native.IExternalSchemaConsumer
See Also