Skip to content
Spreadsheet Engine

PivotCache

Runtime representation of a pivot cache: wraps the JSF PivotCache definition and exposes resolved records with shared-item indices replaced by actual values.

new PivotCache(jsf): PivotCache;

PivotCache

PivotCache

readonly jsf: PivotCache;
get compiledCalcFields(): ReadonlyMap<number, CompiledCalcField>;

Compiled calc-field formulas, keyed by cache field index. Populated for fields with a formula that compiles successfully; missing entries mean no formula or an unsupported one (treated as if the field had no formula).

Layout consumes these under Excel’s aggregate-then-apply model: each cell sums the formula’s referenced source fields over the contributing records (inlining any referenced calc field over those sums), then calls evaluate once with those scalars substituted (see CalcFieldAggregator).

ReadonlyMap<number, CompiledCalcField>


get fieldNames(): string[];

string[]


get resolvedRecords(): readonly readonly CellValue[][];

The records with every calc-field column resolved. Indexing resolvedRecords[r][fieldIndex] returns a real value for any field, so this getter first materializes any calc-field column not yet filled (a no-op once they all are). Use it when you need an arbitrary field’s value and cannot assume it has been resolved. When resolution has already happened, or only specific calc fields are needed, read records instead (resolving just those via ensureCalcFieldsResolved) to avoid materializing columns no one reads.

readonly readonly CellValue[][]


get sourceRef(): string | undefined;

string | undefined


get sourceSheet(): string | undefined;

string | undefined

adjustSourceRangeForMove(
sheetName,
dimension,
from,
to,
count): void;

Adjust the source data range after a row/column reorder on a sheet (a move of the block [from, from + count) landing with its first row/column at to). Unlike the delete-then-insert model of adjustSourceRange, a source range fully inside the moved block follows it to the new position: the move keeps the source data intact, so clearing the ref (the genuine-deletion outcome) would silently disable refresh. Any other range gets the delete-then-insert adjustment, which matches Excel for ranges the move partially overlaps (see excel-test/pivot-move-source/verify.js).

string

Dimension

number

number

number

void