Skip to main content

SelectNode.SubNodes Property

Provides access to JOIN clauses.

Namespace: DevExpress.DataAccess.DataFederation

Assembly: DevExpress.DataAccess.v24.1.dll

NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap

Declaration

[Browsable(false)]
public JoinElementCollection SubNodes { get; }

Property Value

Type Description
JoinElementCollection

A collection of JOIN clauses.

Example

This code snippet demonstrates how to create a query that combnes two tables from different data sources with the JOIN clause.

Note

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

using DevExpress.DataAccess.DataFederation;
// ...
    FederationDataSource federation = new FederationDataSource();

    Source sourceProducts = new Source("Products", CreateSqlDataSource(), "Products");
    Source sourceOrderDetail = new Source("OrderDetail", CreateExcelDataSource("SalesPerson.xlsx", "Data"));

    var sourceNodeProducts = new SourceNode(sourceProducts, "Products");
    var sourceNodeOrderDetail = new SourceNode(sourceOrderDetail, "OrderDetail");

    var query = new SelectNode(sourceNodeProducts)
    {
        Alias = "ProductsOrderDetail",
        SubNodes = {
                new JoinElement {
                    Node = sourceNodeOrderDetail,
                    Condition = $"[{sourceNodeProducts.Alias}.ProductName] == [{sourceNodeOrderDetail.Alias}.ProductName]"
                }
            },
        Expressions = {
            new SelectColumnExpression(sourceNodeProducts, "ProductName"),
            new SelectColumnExpression(sourceNodeProducts, "QuantityPerUnit"),
            new SelectColumnExpression(sourceNodeOrderDetail, "OrderID"),
            new SelectColumnExpression(sourceNodeOrderDetail, "OrderDate"),
            new SelectColumnExpression(sourceNodeOrderDetail, "Quantity"),
            new SelectColumnExpression(sourceNodeOrderDetail, "UnitPrice")
            }
    };
    federation.Queries.Add(query);
    federation.Fill();
See Also