PivotTableJsonWriter Class

NReco.PivotData Class Library Documentation
Serializes pivot table data to JSON string.
Inheritance Hierarchy

SystemObject
  NReco.PivotData.OutputPivotTableJsonWriter

Namespace:  NReco.PivotData.Output
Assembly:  NReco.PivotData.Extensions (in NReco.PivotData.Extensions.dll) Version: 1.4.2
Syntax

public class PivotTableJsonWriter

The PivotTableJsonWriter type exposes the following members.

Constructors

  NameDescription
Public methodPivotTableJsonWriter
Initializes a new instance of the PivotTableJsonWriter class
Top
Properties

  NameDescription
Public propertyFormatDimensionLabel
Gets or sets custom formatting handler for dimension labels (JSON: 'Columns' and 'Rows' arrays).
Public propertyFormatKey
Gets or sets custom formatting handler for table row/column labels (key,dimension)->(label).
Public propertyFormatMeasureHeader
Gets or sets custom formatting handler for measure headers (JSON: 'MeasureLabels' array).
Public propertyFormatValue
Gets or sets custom formatting handler for table cell values (measure,measure index)->(value)
Public propertyIncludeTotals
Get or sets flag which indicates whether writer should include pivot table values into JSON (true by default).
Public propertyIncludeValues
Get or sets flag which indicates whether writer should include pivot table values into JSON (true by default).
Top
Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Public methodWrite
Serializes pivot table to JSON string.
Top
Remarks

This writer produces the following JSON structure by any IPivotTable:
{
    Columns : ["C1", "C2"], // column dimensions
    ColumnKeys : [ ["C1_val1", "C1_val2"], [ "C2_val" ] ], // array of dimension keys for each column
    Rows : ["R1"], // row dimensions
    RowKeys : [ ["R1_val1", "R1_val2", "R3_val3"] ], // array of dimension keys for each row    
    Values : [    // array of rows, each row is array of column values
        [ row_0_col0_value, row_0_col1_value],
        [ row_1_col0_value, row_1_col1_value],
        [ row_2_col0_value, row_2_col1_value]
    ],
    GrandTotal : total_value, // depends on cube measures configuration 
    ColumnTotals : [ col_0_subtotal_value, col_1_subtotal_value ], // array of values for column sub-totals
    RowTotals : [ row_0_subtotal_value, row_1_subtotal_value, row_2_subtotal_value ], // array of values for row sub-totals
    MeasureLabels : ["Count", "Sum of amount"] // array of measure names
}
Important notice: value type depends on the number of cube measures. If cube has only 1 measure values are written as primitive types (numbers or strings). Otherwise value is an array like:
GrandTotal : [70 /* count */, 564.4 /* sum of amount */ ]
.
See Also

Reference