skipcheck

TM1 client · Docs · Cubes and views

CubeService

import io.skipcheck.tm1.client.service.cube.CubeService;

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
return tm1.cubes()
    .modelCubes(ODataQuery.none()
        .select(Cube.NAME)
        .filter(Filter.startsWith(Cube.NAME, "Sales"))
        .orderBy(Cube.NAME))
    .map(Cube::name);

Create a cube over existing dimensions, bound in order:

// A cube over two existing dimensions, in this order
ODataPath 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
String rules = "SKIPCHECK;\n['Margin'] = N: ['Revenue'] - ['Cost'];";
return tm1.cubes()
    .checkRules("Sales", rules)
    .collectList()
    .flatMap(errors -> errors.isEmpty() ? tm1.cubes().update("Sales", CubePatch.builder().rules(rules).build())
            : Mono.error(new IllegalArgumentException("The rules don't compile: " + errors)));

Members

CubeService constructorA service sending its requests through session.
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.
getGET Cubes('name').
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.
updatePATCH Cubes('name') with If-Match.
deleteDELETE Cubes('name'), with its data and views; its dimensions stay.
dimensionsGET Cubes('name')/Dimensions, streamed, in the cube's order.
dimensionsStorageOrderThe cube's dimensions in the order TM1 stores them, which can differ from the order they're presented in.
reorderDimensionsChanges the order TM1 stores the cube's dimensions in, which changes its memory use but not how it's presented.
loadLoads the cube into memory, if it isn't.
unloadFrees the cube's memory; TM1 loads it again when it's next used.
lockStops everyone else changing the cube until it's unlocked.
unlocktm1.Unlock.
reserveStops everyone else changing the cube until it's released.
releasetm1.Release.
checkRulesCompiles the cube's saved rules and lists their errors.
checkRulestm1.CheckRules with Rules.
traceCellCalculationHow a cell's value is calculated, as a tree of rule and consolidation components.
traceFeedersWhich cells a cell feeds, and the feeder statements that do it.
checkFeedersThe cells under a consolidated cell that are fed, not fed, or both, to find missing feeders.

CubeService

constructor
CubeService(Tm1Session session)

A service sending its requests through session.

Parameters

session
the session

list

Flux<Cube> list(ODataQuery query)

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

Parameters

query
what to select, expand, filter and order

Returns

the cubes

TM1 REST EntitySet Cubes

modelCubes

Flux<Cube> modelCubes(ODataQuery query)

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

Parameters

query
what to select, expand, filter and order

Returns

the model cubes

TM1 REST FunctionImport ModelCubes

controlCubes

Flux<Cube> controlCubes(ODataQuery query)

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

Parameters

query
what to select, expand, filter and order

Returns

the control cubes

TM1 REST FunctionImport ControlCubes

get

Mono<Cube> get(String name, ODataQuery query)

GET Cubes('name').

Parameters

name
the cube's name
query
what to select and expand

Returns

the cube, or a Tm1NotFoundException if there's none

TM1 REST EntitySet Cubes

create

Mono<Cube> create(CubePatch cube)

POST Cubes: creates a cube over existing dimensions, bound in order with CubePatch.Builder#bindDimensions, and optionally its rules.

Parameters

cube
the new cube; it needs a name and at least two dimensions

Returns

the cube as created

TM1 REST EntitySet Cubes

update

Mono<Void> update(String name, CubePatch patch)

PATCH Cubes('name'): changes the properties the patch sets, typically Rules or DrillthroughRules; null clears them.

TM1 (11.8) saves rules even when they don't compile: check them first with checkRules.

Parameters

name
the cube's name
patch
the changes

Returns

completes when the cube is changed

TM1 REST EntitySet Cubes

update

Mono<Void> update(String name, CubePatch patch, String etag)

PATCH Cubes('name') with If-Match: changes the properties the patch sets, unless the cube changed since it was read. TM1 (11.8) saves rules even when they don't compile.

Parameters

name
the cube's name
patch
the changes
etag
the ETag the cube was read with (Cube.etag)

Returns

completes when the cube is changed, or a Tm1PreconditionFailedException if it had changed

TM1 REST EntitySet Cubes

delete

Mono<Void> delete(String name)

DELETE Cubes('name'), with its data and views; its dimensions stay.

Parameters

name
the cube's name

Returns

completes when the cube is deleted

TM1 REST EntitySet Cubes

dimensions

Flux<Dimension> dimensions(String name, ODataQuery query)

GET Cubes('name')/Dimensions, streamed, in the cube's order.

TM1 (11.8) lists its virtual Sandboxes dimension first, before the dimensions the cube was made of; skip it to get those.

Parameters

name
the cube's name
query
what to select, expand, filter and order

Returns

the cube's dimensions, Sandboxes first

TM1 REST Navigation Cube/Dimensions

dimensionsStorageOrder

Flux<Dimension> dimensionsStorageOrder(String name, ODataQuery query)

tm1.DimensionsStorageOrder(): the cube's dimensions in the order TM1 stores them, which can differ from the order they're presented in. Needs schema 11.4.0.

Parameters

name
the cube's name
query
what to select of each dimension

Returns

the dimensions in storage order

TM1 REST Function Cube/DimensionsStorageOrder

reorderDimensions

Mono<Double> reorderDimensions(String name, List<String> dimensions)

tm1.ReorderDimensions: changes the order TM1 stores the cube's dimensions in, which changes its memory use but not how it's presented. Needs schema 11.4.0.

Parameters

name
the cube's name
dimensions
the cube's dimensions, in the new storage order

Returns

the change in the cube's memory use, as TM1 reports it (a percentage)

TM1 REST Action Cube/ReorderDimensions

load

Mono<Void> load(String name)

tm1.Load: loads the cube into memory, if it isn't. Needs schema 11.6.0.

Parameters

name
the cube's name

Returns

completes when the cube is loaded

TM1 REST Action Cube/Load

unload

Mono<Void> unload(String name)

tm1.Unload: frees the cube's memory; TM1 loads it again when it's next used. Needs schema 11.6.0.

Parameters

name
the cube's name

Returns

completes when the cube is unloaded

TM1 REST Action Cube/Unload

lock

Mono<Void> lock(String name)

tm1.Lock: stops everyone else changing the cube until it's unlocked.

Parameters

name
the cube's name

Returns

completes when the cube is locked

TM1 REST Action Cube/Lock

unlock

Mono<Void> unlock(String name)

tm1.Unlock.

Parameters

name
the cube's name

Returns

completes when the cube is unlocked

TM1 REST Action Cube/Unlock

reserve

Mono<Void> reserve(String name)

tm1.Reserve: stops everyone else changing the cube until it's released. Needs schema 11.8.34.

Parameters

name
the cube's name

Returns

completes when the cube is reserved

TM1 REST Action Cube/Reserve

release

Mono<Void> release(String name)

tm1.Release. Needs schema 11.8.34.

Parameters

name
the cube's name

Returns

completes when the cube is released

TM1 REST Action Cube/Release

checkRules

Flux<RuleSyntaxError> checkRules(String name)

tm1.CheckRules: compiles the cube's saved rules and lists their errors. Needs schema 11.1.0.

Parameters

name
the cube's name

Returns

the syntax errors, with line numbers; none if the rules compile

TM1 REST Action Cube/CheckRules

checkRules

Flux<RuleSyntaxError> checkRules(String name, String rules)

tm1.CheckRules with Rules: compiles rules for the cube without saving them, so they can be checked before update saves them (which TM1 does even when they don't compile). Needs schema 11.1.0.

Parameters

name
the cube's name
rules
the rules to check

Returns

the syntax errors, with line numbers; none if the rules compile

TM1 REST Action Cube/CheckRules

traceCellCalculation

Mono<CalculationComponent> traceCellCalculation(String name, Map<String,String> tuple, ODataQuery query)

tm1.TraceCellCalculation: how a cell's value is calculated, as a tree of rule and consolidation components. Needs schema 11.1.0.

Parameters

name
the cube's name
tuple
the cell: dimension name to element name, for every dimension of the cube in its order (a LinkedHashMap); each element is in its dimension's same-named hierarchy
query
what to expand of the result, such as Components, Tuple or Cube

Returns

the calculation's root component

traceFeeders

Mono<FeederTrace> traceFeeders(String name, Map<String,String> tuple, ODataQuery query)

tm1.TraceFeeders: which cells a cell feeds, and the feeder statements that do it. Needs schema 11.1.0.

Parameters

name
the cube's name
tuple
the cell, as for traceCellCalculation
query
what to expand of the result, such as FedCells/Tuple: FedCells is a complex property, so TM1 wants a path, not nested options (FedCells($expand=Tuple) gets 400)

Returns

the trace

checkFeeders

Flux<FedCellDescriptor> checkFeeders(String name, Map<String,String> tuple, CheckFeedersSelection selection, ODataQuery query)

tm1.CheckFeeders: the cells under a consolidated cell that are fed, not fed, or both, to find missing feeders. Needs schema 11.1.0.

Parameters

name
the cube's name
tuple
the cell, as for traceCellCalculation
selection
which cells to list
query
what to expand of each cell, such as Tuple or Cube

Returns

the cells, streamed

Also in the Javadoc.