Skip to main content
All docs
V23.2

TransformationNodeBuilder Class

Contains methods that allow you to create transformation-based queries to sources of the Federation Data Source.

Namespace: DevExpress.DataAccess.DataFederation

Assembly: DevExpress.DataAccess.v23.2.dll

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

Declaration

public class TransformationNodeBuilder

Remarks

The Federation Data Source allows you to combine data from multiple sources. Use the TransformationNodeBuilder class to unfold and/or flatten columns of these sources. To do this,

  1. Call the Transform method for a Source object to create a TransformationNodeBuilder object. You can also create a transformation-based query after you apply the Select/Join and/or Union/UnionAll operations. Refer to the Transform(IJoinNode) method description for more details.
  2. Apply transformations for the created TransformationNodeBuilder object. Call the FlattenColumn method to flatten a column, the UnfoldColumn method to unfold a column, and the TransformColumn method to unfold and then flatten a column.
  3. After all the operations are applied, call the Build() method for the TransformationNodeBuilder object to create a TransformationNode object. If this method is called last, pass the name of the node as the first argument to this method.
  4. Add the created TransformationNode object to the Query collection of the Federation Data Source.

Example

The following example demonstrates how to unfold and flatten the Products array of two data sources and unite data from these sources.

Show JSON Data (Products1.json)
[
    {
        "CategoryID": 1,
        "Products":
        [
            {
                "ProductName": "Chai",
                "UnitPrice": 18
            },
            {
                "ProductName": "Chang",
                "UnitPrice": 19
            }
        ]
    },
    {
        "CategoryID": 2,
        "Products":
        [
            {
                "ProductName": "Ikura",
                "UnitPrice": 31
            },
            {
                "ProductName": "Konbu",
                "UnitPrice": 6
            }
        ]
    }
]
Show JSON Data (Products2.json)
[
    {
        "CategoryID": 1,
        "Products":
        [
            {
                "ProductName": "Chai",
                "UnitPrice": 18
            },
            {
                "ProductName": "Chang",
                "UnitPrice": 19
            }
        ]
    },
    {
        "CategoryID": 2,
        "Products":
        [
            {
                "ProductName": "Ikura",
                "UnitPrice": 31
            },
            {
                "ProductName": "Konbu",
                "UnitPrice": 6
            }
        ]
    }
]
using DevExpress.DataAccess.DataFederation;
using DevExpress.DataAccess.Json;
// ...
var source1 = new Source("Products1", jsonDataSource1);
var source2 = new Source("Products2", jsonDataSource2);

var query1 = source1
    .Transform()
    .TransformColumn("Products")
    .Build();

var query2 = source2
    .Transform()
    .TransformColumn("Products")
    .Build();

var query = query1
    .Union(query2)
    .Build("ProductsUnited");

var federation = new FederationDataSource() {
    Queries = { query }
};

The following schema is the result of the transformation:

"CategoryID": int
"Products_ProductName": string
"Products_UnitPrice" : string

Inheritance

Object
TransformationNodeBuilder
See Also