skipcheck

TM1 client · Docs · Cubes and views

CubeService

import { CubeService } from "@skipcheck/tm1-client";

Used in the walkthroughs Connect and list your cubes, Test your code against a real TM1, Add TM1 to a Spring Boot application.

Cubes: /Cubes, a cube's dimensions, and the operations bound to a cube. Views have a service of their own; cell data is read and written through cellsets.

List cubes with a query: here, the model cubes whose names start with "Sales".

// The names of the model cubes starting with "Sales", in name order
const sales = ODataQuery.none().select(Cube.Fields.Name).filter(Filter.startsWith(Cube.Fields.Name, "Sales")).orderBy(Cube.Fields.Name);
const cubes = await tm1.cubes.modelCubes(sales).toArray();
return cubes.map((cube) => cube.Name!);

Create a cube over existing dimensions, bound in order:

// A cube over two existing dimensions, in this order
const dimensions = ODataPath.of("Dimensions");
return tm1.cubes.create(CubePatch.builder().name("Sales").bindDimensions(dimensions.key("Region"), dimensions.key("Month")).build());

Change a cube's rules, checking them first:

// TM1 saves rules even when they don't compile, so check them first
const rules = "SKIPCHECK;\n['Margin'] = N: ['Revenue'] - ['Cost'];";
const errors = await tm1.cubes.checkRules("Sales", rules).toArray();
if (errors.length > 0) throw new Error("The rules don't compile: " + JSON.stringify(errors));
await tm1.cubes.update("Sales", CubePatch.builder().rules(rules).build());

Members

listEvery cube, control cubes included, streamed.
modelCubesThe cubes that aren't control cubes (whose names start with }), streamed.
controlCubesThe control cubes, such as }ClientGroups, streamed.
getThe cube, or a Tm1NotFoundException if there's none.
createCreates a cube over existing dimensions, bound in order with CubePatch.builder().bindDimensions(…), and optionally its rules.
updateChanges the properties the patch sets, typically Rules or DrillthroughRules; null clears them.
deleteDELETE Cubes('name').
dimensionsThe cube's dimensions, in the cube's order.
dimensionsStorageOrderThe dimensions in the order TM1 stores the cube's cells.
reorderDimensionsChanges the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage.
loadLoads the cube into memory.
unloadUnloads the cube from memory.
locktm1.Lock.
unlocktm1.Unlock.
reserveNo one else can change the cube until it's released.
releasetm1.Release.
checkRulesThe syntax errors in the cube's rules, or in rules if given (checked as if they were the cube's, without saving them); none if they compile.
traceCellCalculationHow a cell's value is calculated, component by component; tuple maps each dimension to an element.
traceFeedersWhat a cell feeds.
checkFeedersThe cells under a consolidated cell that aren't fed though they have values, chosen by selection.

list

list(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Cube>

GET Cubes: every cube, control cubes included, streamed.

TM1 REST EntitySet Cubes

modelCubes

modelCubes(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Cube>

ModelCubes(): the cubes that aren't control cubes (whose names start with }), streamed.

TM1 REST FunctionImport ModelCubes

controlCubes

controlCubes(query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Cube>

ControlCubes(): the control cubes, such as }ClientGroups, streamed.

TM1 REST FunctionImport ControlCubes

get

get(name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<Cube>

GET Cubes('name'): the cube, or a Tm1NotFoundException if there's none.

TM1 REST EntitySet Cubes

create

create(cube: CubePatch, options?: Tm1CallOptions): Promise<Cube>

POST Cubes: creates a cube over existing dimensions, bound in order with CubePatch.builder().bindDimensions(…), and optionally its rules. It needs a name and at least two dimensions; returns the cube as created.

TM1 REST EntitySet Cubes

update

update(name: string, patch: CubePatch, etag?: string | null, options?: Tm1CallOptions): Promise<void>

PATCH Cubes('name'): changes the properties the patch sets, typically Rules or DrillthroughRules; null clears them. With etag (cube["@odata.etag"], from a read), sent as If-Match: only if the cube hasn't changed since, else a Tm1PreconditionFailedException. TM1 (11.8) saves rules even when they don't compile: check them first with checkRules.

TM1 REST EntitySet Cubes

delete

delete(name: string, options?: Tm1CallOptions): Promise<void>

DELETE Cubes('name').

TM1 REST EntitySet Cubes

dimensions

dimensions(name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Dimension>

GET Cubes('name')/Dimensions: the cube's dimensions, in the cube's order. TM1 (11.8) lists the virtual Sandboxes dimension first.

TM1 REST Navigation Cube/Dimensions

dimensionsStorageOrder

dimensionsStorageOrder(name: string, query?: ODataQuery | null, options?: Tm1CallOptions): Tm1Stream<Dimension>

tm1.DimensionsStorageOrder(): the dimensions in the order TM1 stores the cube's cells.

TM1 REST Function Cube/DimensionsStorageOrder

reorderDimensions

reorderDimensions(name: string, dimensions: readonly string[], options?: Tm1CallOptions): Promise<number>

tm1.ReorderDimensions: changes the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage.

TM1 REST Action Cube/ReorderDimensions

load

load(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Load: loads the cube into memory.

TM1 REST Action Cube/Load

unload

unload(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Unload: unloads the cube from memory.

TM1 REST Action Cube/Unload

lock

lock(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Lock.

TM1 REST Action Cube/Lock

unlock

unlock(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Unlock.

TM1 REST Action Cube/Unlock

reserve

reserve(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Reserve: no one else can change the cube until it's released.

TM1 REST Action Cube/Reserve

release

release(name: string, options?: Tm1CallOptions): Promise<void>

tm1.Release.

TM1 REST Action Cube/Release

checkRules

checkRules(name: string, rules?: string | null, options?: Tm1CallOptions): Tm1Stream<RuleSyntaxError>

tm1.CheckRules: the syntax errors in the cube's rules, or in rules if given (checked as if they were the cube's, without saving them); none if they compile.

TM1 REST Action Cube/CheckRules

traceCellCalculation

traceCellCalculation(name: string, tuple: Tm1Map<string>, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<CalculationComponent>

tm1.TraceCellCalculation: how a cell's value is calculated, component by component; tuple maps each dimension to an element.

TM1 REST Action Cube/TraceCellCalculation Navigation CalculationComponent/Cube Navigation CalculationComponent/Tuple

traceFeeders

traceFeeders(name: string, tuple: Tm1Map<string>, query?: ODataQuery | null, options?: Tm1CallOptions): Promise<FeederTrace>

tm1.TraceFeeders: what a cell feeds. TM1 (11.8) needs a path to expand into a complex property (FedCells/Tuple); nested options (FedCells($expand=Tuple)) get 400.

TM1 REST Action Cube/TraceFeeders Navigation FedCellDescriptor/Cube Navigation FedCellDescriptor/Tuple

checkFeeders

checkFeeders( name: string, tuple: Tm1Map<string>, selection: CheckFeedersSelection, query?: ODataQuery | null, options?: Tm1CallOptions, ): Tm1Stream<FedCellDescriptor>

tm1.CheckFeeders: the cells under a consolidated cell that aren't fed though they have values, chosen by selection.

TM1 REST Action Cube/CheckFeeders Navigation FedCellDescriptor/Cube Navigation FedCellDescriptor/Tuple