Skip to main content
All docs
V24.2

TransformationNodeBuilder.TransformColumn(String, String) Method

Transforms a column and specifies a new name for this column.

Namespace: DevExpress.DataAccess.DataFederation

Assembly: DevExpress.DataAccess.v24.2.dll

Declaration

public TransformationNodeBuilder TransformColumn(
    string columnName,
    string alias
)

Parameters

Name Type Description
columnName String

The name of a column that should be transformed.

alias String

A new column name.

Returns

Type Description
TransformationNodeBuilder

The result of the transformation query.

Remarks

If a column is an array, the TransformColumn method unfolds this column and then flattens it. The Unfold operation transforms each element of the array into an individual record. The Flatten operation creates individual columns from the fields of these records.

Example

The following example demonstrates how to unfold and flatten a data source’s Products array and specify a new name for this array:

Show JSON Data
[
    {
        "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 source = new Source("Products", jsonDataSource);

var query = source
    .Transform()
    .TransformColumn("Products", "ProductsInfo")
    .Build("ProductsUnfoldedAndFlattened");

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

The following schema is the result of the transformation:

"CategoryID": int
"ProductsInfo_ProductName": string
"ProductsInfo_UnitPrice": int
See Also