Pivot<TInput>

Class Pivot<TInput>

Use the Pivot transformation to pivot your data.

Inherited Members
Namespace: ETLBox.DataFlow
Assembly: ETLBox.dll
Syntax
    public class Pivot<TInput> : DataFlowTransformation<TInput, ExpandoObject>, IDataFlowTransformation<TInput, ExpandoObject>, IDataFlowSource<ExpandoObject>, IDataFlowSource, IDataFlowDestination<TInput>, IDataFlowDestination, IDataFlowComponent, ILoggableTask
Type Parameters
NameDescription
TInput

Type of incoming rows

Examples
Month,MonthValue
Jan,100
Feb,200
Mar,300
will become
Jan,Feb,Mar
100,200,300

Constructors

Pivot()

Declaration
    public Pivot()

Properties

AddGrandTotalColumn

Adds a grand total for each column.

Declaration
    public bool AddGrandTotalColumn { get; set; }
Property Value
TypeDescription
bool

AddGrandTotalRows

Adds a grand total for each column.

Declaration
    public bool AddGrandTotalRows { get; set; }
Property Value
TypeDescription
bool

ColumnNameCombination

If set, this function is used to combine the column name for the pivoted columns. Otherwise, the output will concatenate the names of the pivot columns.

Declaration
    public Func<Dictionary<string, object>, string> ColumnNameCombination { get; set; }
Property Value
TypeDescription
Func<Dictionary<string, object>, string>

CustomValueAggregation

Use the ValueAggregationFunc to define how to handle aggregation of the values in the input data. Setting this function is not required. If you don't set it, the PivotValues attributes and their AggregationMethod (or CustomFunction) will be used to aggregate the values. If set, this will override any CustomFunction or AggregationMethod set in the PivotValues attributes.

Declaration
    public Func<Pivot<TInput>.ValueAggregationInput, object> CustomValueAggregation { get; set; }
Property Value
TypeDescription
Func<Pivot<TInput>.ValueAggregationInput, object>

FlattenAggregationResults

This only applies if 2 or more PivotValues are specified. All PivotValues will be aggregated into an array of PivotAggregationResult objects. This function can be used to flatten the array of PivotAggregationResult objects into a single value.

Declaration
    public Func<PivotAggregationResult[], string, object> FlattenAggregationResults { get; set; }
Property Value
TypeDescription
Func<PivotAggregationResult[], string, object>

KeepEmptyValues

By default, all rows will contain all columns, even if they are empty (null). Set this to false, and the dynamic output object won't contain columns that are empty/null.

Declaration
    public bool KeepEmptyValues { get; set; }
Property Value
TypeDescription
bool

MaxBufferSize

Declaration
    public int MaxBufferSize { get; }
Property Value
TypeDescription
int

PivotColumns

Columns by which the data should be pivoted - all other columns will be kept as a group column. If you want to avoid grouping, you need to remove these columns from your data before using the pivot transformation. (E.g. with the ColumnTransformation<TInput>)

Declaration
    public ICollection<PivotColumn> PivotColumns { get; set; }
Property Value
TypeDescription
ICollection<PivotColumn>

PivotRows

The rows that are kept in the output. If not set, all rows are kept.

Declaration
    public ICollection<PivotRow> PivotRows { get; set; }
Property Value
TypeDescription
ICollection<PivotRow>

PivotValues

Value columns which contain the values for the pivot columns.

Declaration
    public ICollection<PivotValue> PivotValues { get; set; }
Property Value
TypeDescription
ICollection<PivotValue>

ProgressCount

Declaration
    public int ProgressCount { get; }
Property Value
TypeDescription
int

SourceBlock

SourceBlock from the underlying TPL.Dataflow which is used as output buffer for the component.

Declaration
    public override ISourceBlock<ExpandoObject> SourceBlock { get; }
Property Value
TypeDescription
ISourceBlock<ExpandoObject>
Overrides

TargetBlock

TargetBlock from the underlying TPL.Dataflow which is used as input buffer for the component.

Declaration
    public override ITargetBlock<TInput> TargetBlock { get; }
Property Value
TypeDescription
ITargetBlock<TInput>
Overrides

Methods

CheckParameter()

Declaration
    protected override void CheckParameter()
Overrides

CleanUpOnFaulted(Exception)

Declaration
    protected override void CleanUpOnFaulted(Exception e)
Parameters
TypeNameDescription
Exceptione
Overrides

CleanUpOnSuccess()

Declaration
    protected override void CleanUpOnSuccess()
Overrides

InitComponent()

Declaration
    protected override void InitComponent()
Overrides

LinkErrorTo(IDataFlowDestination<ETLBoxError>)

If an error occurs in the component, by default the component will throw an exception and stop execution. If you use the error linking, any erroneous records will be caught and redirected.

Declaration
    public override IDataFlowSource<ETLBoxError> LinkErrorTo(IDataFlowDestination<ETLBoxError> target)
Parameters
TypeNameDescription
IDataFlowDestination<ETLBoxError>target

The target for erroneous rows.

Returns
TypeDescription
IDataFlowSource<ETLBoxError>

The linked component.

Overrides

PrepareParameterForCheck()

Declaration
    protected override void PrepareParameterForCheck()
Overrides

Reset()

Declaration
    protected override void Reset()
Overrides

Implements