Skip to content

SubtotalRow

type SubtotalRow = object;

A subtotal row in the pivot table output, aggregating a group of data rows for one level of the row field hierarchy. Treat as immutable after buildLayout returns.

optional aggs?: Aggregator[][];

Per-(col, data-field) aggregator state from aggregateSubtotalGroup’s matching branch, indexed as aggs[colIndex][dataFieldIndex]. When present, computeSubtotalIntersections folds across the col-subtotal range by combining these per-column aggregators directly, avoiding the inner row loop. Populated only on non-separator / non-blank rows when the col axis can produce subtotals; cleared after intersections are computed. Diverging-aggregation slots are left undefined (those fall through to the record-walk path).


optional colSubtotalData?: CellValue[][];

Per-(col-subtotal-entry, data-field) intersection values, indexed as colSubtotalData[colSubtotalIdx][dataFieldIdx]. Each cell aggregates records whose row keys fall in this row’s group AND whose col keys fall in the col subtotal’s group. Populated only when both axes have subtotals and the row-subtotal’s effective aggregation matches the data field’s own; absent for separator and blank rows.


data: CellValue[][];

Aggregated values, indexed as data[colIndex][dataFieldIndex]. The row dimension is absent because the subtotal aggregates across all rows in its group.


fieldLevel: number;

Row field level (index into rowFieldIndices) this subtotal aggregates.


groupKey: CellValue[];

Header values up to and including the subtotaled level.


optional isBlank?: boolean;

When true, a fully-blank separator emitted at the end of each outer group when the field declares insertBlankRow="1". Distinct from isSeparator in that it carries no label. Excluded from GETPIVOTDATA matching.


optional isSeparator?: boolean;

When true, this is a layout-only separator/header for an outer group: carries the bare outer-field label and blank data cells. Excel emits these for tabular defaultSubtotal="0" outline-mode fields and for compact-mode fields with explicit multi-function subtotalFunctions. Excluded from GETPIVOTDATA matching.


optional outlineAbove?: boolean;

When true, the subtotal sits ABOVE its group’s data rows (Excel-default “outline” placement) rather than below. Label is the bare outer value with no ” Total” suffix; inner data rows blank the outer-field column. Activated when the field’s effective layout is non-compact and outline-mode is on.


outputRowIndex: number;

Position in the output row sequence (0-based, among data rows and other subtotals; the grand total row is not counted).


rowGrandTotal: CellValue[];

Row grand total: rowGrandTotal[dataFieldIndex].


rowGroupEnd: number;

rowGroupStart: number;

Inclusive row-header range [rowGroupStart, rowGroupEnd] of the aggregated group.


subtotalFunction: PivotSubtotalFunction | "default";

Subtotal function ('default' uses each data field’s own aggregation).