CellService
import { CellService } from "@skipcheck/tm1-client";Used in the walkthroughs Read and write cells, Run a process and read its result.
Cell writes to a cube, by coordinates. Cells are given as Tuples.of maps of
dimension to element; reading is through cellsets (CellsetService), and writing
into one by ordinal is there too.
Values are numbers for numeric cells and text for string cells; null clears a
cell. TM1 (11.8) refuses a write to a consolidated cell (400,
CubeCellWriteStatusElementIsConsolidated): it doesn't spread; write the leaves.
tm1.Update takes several cells, but TM1 (11.8) writes only the first, so
update takes one; updateCells writes many in one request.
Write one cell, given an element for every dimension of the cube, in order:
// The cell: an element for every dimension of the cube, in the cube's order
const cell = { Version: "Budget", Region: "North", Month: "Jan", Measure: "Revenue" };
return tm1.cells.update("Sales", cell, 1200);
Write many cells in one request:
// A budget for North, one value per month, written in one request
const budget = { Jan: 1200, Feb: 1350, Mar: 1100 };
const updates = Object.entries(budget).map(([month, value]) => {
const cell = { Version: "Budget", Region: "North", Month: month, Measure: "Revenue" };
return CubeUpdatePatch.builder()
.bindTuple(...Tuples.of(cell))
.value(value)
.build();
});
return tm1.cells.updateCells("Sales", updates);
Members
update | Writes one value to a cell; tuple maps dimension to element, as for Tuples.of, and a null value clears the cell. |
updateCells | Writes many cells, each its own value, in one request. |
updateCells | tm1.UpdateCells with an order. |
updateCells |
update
update(cube: string, tuple: Tm1Map<string>, value: unknown, options?: Tm1CallOptions): Promise<void>tm1.Update: writes one value to a cell; tuple maps dimension to element, as for Tuples.of, and a null value clears the cell.
TM1 REST Action Cube/Update Navigation CellDescriptor/Tuple
updateCells
updateCells(cube: string, updates: readonly CubeUpdatePatch[], options?: Tm1CallOptions): Promise<void>tm1.UpdateCells: writes many cells, each its own value, in one request: each update is CubeUpdatePatch.builder().bindTuple(...Tuples.of(cell)).value(v), or with a reference cube and cell to copy from. With order, ByLevel writes leaves before the consolidations above them, so a spread to a consolidation isn't overwritten. Needs schema 11.0.0. TM1 (11.8) requires a Tuple and a Value in every update (400 otherwise); on a leaf a ReferenceCube and ReferenceCell didn't change what's written, and they don't copy that cell's value.
updateCells
updateCells(cube: string, updates: readonly CubeUpdatePatch[], order: UpdateOrder, options?: Tm1CallOptions): Promise<void>tm1.UpdateCells with an order: ByLevel writes leaves before the consolidations above them, so a spread to a consolidation isn't overwritten. TM1 (11.8) requires a Tuple and a Value in every update (400 otherwise).
updateCells
updateCells(cube: string, updates: readonly CubeUpdatePatch[], order?: UpdateOrder | Tm1CallOptions, options?: Tm1CallOptions): Promise<void>