CubeService
using Skipcheck.Tm1.Client.Services;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.ModelCubesAsync(ODataQuery.None().Select(Cube.Fields.Name).Filter(Filter.StartsWith(Cube.Fields.Name, "Sales")).OrderBy(Cube.Fields.Name))
.Select(cube => cube.Name!);
Create a cube over existing dimensions, bound in order:
// A cube over two existing dimensions, in this order
var dimensions = ODataPath.Of("Dimensions");
return await tm1.Cubes.CreateAsync(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
var rules = "SKIPCHECK;\n['Margin'] = N: ['Revenue'] - ['Cost'];";
var errors = await tm1.Cubes.CheckRulesAsync("Sales", rules).ToListAsync();
if (errors.Count > 0)
{
throw new ArgumentException("The rules don't compile: " + string.Join("; ", errors.Select(e => e.Message)));
}
await tm1.Cubes.UpdateAsync("Sales", CubePatch.Builder().Rules(rules).Build());
Members
CubeService constructor | A service that sends its requests through session. |
ListAsync | Every cube, control cubes included, streamed. |
ModelCubesAsync | The cubes that aren't control cubes (whose names start with }), streamed. |
ControlCubesAsync | The control cubes, such as }ClientGroups, streamed. |
GetAsync | The cube, or a Tm1NotFoundException if there's none. |
CreateAsync | Creates a cube over existing dimensions, bound in order with CubePatch.PatchBuilder.BindDimensions, and optionally its rules. |
UpdateAsync | Changes the properties the patch sets, typically Rules or DrillthroughRules; null clears them. |
DeleteAsync | DELETE Cubes('name'). |
DimensionsAsync | The cube's dimensions, in the cube's order. |
DimensionsStorageOrderAsync | The dimensions in the order TM1 stores the cube's cells. |
ReorderDimensionsAsync | Changes the order TM1 stores the cube's cells in, and returns the change in memory use, as a percentage. |
LoadAsync | Loads the cube into memory. |
UnloadAsync | Unloads the cube from memory. |
LockAsync | tm1.Lock. |
UnlockAsync | tm1.Unlock. |
ReserveAsync | No one else can change the cube until it's released. |
ReleaseAsync | tm1.Release. |
CheckRulesAsync | 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. |
TraceCellCalculationAsync | How a cell's value is calculated, component by component; tuple maps each dimension to an element. |
TraceFeedersAsync | What a cell feeds. |
CheckFeedersAsync | The cells under a consolidated cell that aren't fed though they have values, chosen by selection. |
CubeService
constructorCubeService(Tm1Session session)A service that sends its requests through session.
ListAsync
IAsyncEnumerable<Cube> ListAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)GET Cubes: every cube, control cubes included, streamed.
TM1 REST EntitySet Cubes
ModelCubesAsync
IAsyncEnumerable<Cube> ModelCubesAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)ModelCubes(): the cubes that aren't control cubes (whose names start with }), streamed.
TM1 REST FunctionImport ModelCubes
ControlCubesAsync
IAsyncEnumerable<Cube> ControlCubesAsync(ODataQuery? query = null, CancellationToken cancellationToken = default)ControlCubes(): the control cubes, such as }ClientGroups, streamed.
TM1 REST FunctionImport ControlCubes
GetAsync
Task<Cube> GetAsync(string name, ODataQuery? query = null, CancellationToken cancellationToken = default)GET Cubes('name'): the cube, or a Tm1NotFoundException if there's none.
TM1 REST EntitySet Cubes
CreateAsync
Task<Cube> CreateAsync(CubePatch cube, CancellationToken cancellationToken = default)POST Cubes: creates a cube over existing dimensions, bound in order with
CubePatch.PatchBuilder.BindDimensions, and optionally its rules. It needs a name and at
least two dimensions; returns the cube as created.
TM1 REST EntitySet Cubes
UpdateAsync
Task UpdateAsync(string name, CubePatch patch, string? etag = null, CancellationToken cancellationToken = default)PATCH Cubes('name'): changes the properties the patch sets, typically Rules
or DrillthroughRules; null clears them. With etag (Cube.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 CheckRulesAsync.
TM1 REST EntitySet Cubes
DeleteAsync
Task DeleteAsync(string name, CancellationToken cancellationToken = default)DELETE Cubes('name').
TM1 REST EntitySet Cubes
DimensionsAsync
IAsyncEnumerable<Dimension> DimensionsAsync(string name, ODataQuery? query = null, CancellationToken cancellationToken = default)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
DimensionsStorageOrderAsync
IAsyncEnumerable<Dimension> DimensionsStorageOrderAsync(string name, ODataQuery? query = null, CancellationToken cancellationToken = default)tm1.DimensionsStorageOrder(): the dimensions in the order TM1 stores the cube's cells.
TM1 REST Function Cube/DimensionsStorageOrder
ReorderDimensionsAsync
Task<double> ReorderDimensionsAsync(string name, IReadOnlyList<string> dimensions, CancellationToken cancellationToken = default)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
LoadAsync
Task LoadAsync(string name, CancellationToken cancellationToken = default)tm1.Load: loads the cube into memory.
TM1 REST Action Cube/Load
UnloadAsync
Task UnloadAsync(string name, CancellationToken cancellationToken = default)tm1.Unload: unloads the cube from memory.
TM1 REST Action Cube/Unload
LockAsync
Task LockAsync(string name, CancellationToken cancellationToken = default)tm1.Lock.
TM1 REST Action Cube/Lock
UnlockAsync
Task UnlockAsync(string name, CancellationToken cancellationToken = default)tm1.Unlock.
TM1 REST Action Cube/Unlock
ReserveAsync
Task ReserveAsync(string name, CancellationToken cancellationToken = default)tm1.Reserve: no one else can change the cube until it's released.
TM1 REST Action Cube/Reserve
ReleaseAsync
Task ReleaseAsync(string name, CancellationToken cancellationToken = default)tm1.Release.
TM1 REST Action Cube/Release
CheckRulesAsync
IAsyncEnumerable<RuleSyntaxError> CheckRulesAsync(string name, string? rules = null, CancellationToken cancellationToken = default)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
TraceCellCalculationAsync
Task<CalculationComponent> TraceCellCalculationAsync( string name, IReadOnlyDictionary<string, string> tuple, ODataQuery? query = null, CancellationToken cancellationToken = default )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
TraceFeedersAsync
Task<FeederTrace> TraceFeedersAsync( string name, IReadOnlyDictionary<string, string> tuple, ODataQuery? query = null, CancellationToken cancellationToken = default )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
CheckFeedersAsync
IAsyncEnumerable<FedCellDescriptor> CheckFeedersAsync( string name, IReadOnlyDictionary<string, string> tuple, CheckFeedersSelection selection, ODataQuery? query = null, CancellationToken cancellationToken = default )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