DrillthroughService
using Skipcheck.Tm1.Client.Services; Drillthrough: from a cell to the detail behind it, through a drillthrough process
(}Drill_…). A cube drillthrough returns a cellset, of a view the
process returns; a relational one returns rows from an ODBC source, directly or kept as
a Rowset.
A cell's drillthroughs come from the cube's DrillthroughRules, which name the
process; ScriptsAsync lists them for a cell of a cellset. TM1 (11.8) passes such a
process the cube's name and the cell's element on each of its dimensions, so the
process must declare that many parameters (the cube's name, then one per dimension, in
order); otherwise running the cell's drillthrough fails with "process parameter count
error" (code 248). Run directly (ExecuteProcessAsync), it takes the parameters
given. The returned cellsets and rowsets stay on the server until deleted, like any
cellset.
$metadata declares a relational row (DrillthroughRow) with no
properties and not open, so its columns would all be lost in a typed row: relational
rows come as plain JSON. A rowset's rows (RowsetRow) are open, and keep theirs
in dynamicProperties.
Drill from a cell of a query to the detail behind it:
// The detail behind one cell: query it, run its first cube drillthrough, and read
// the cellset that returns. Both cellsets are deleted at the end.
var cellsets = tm1.Cellsets;
var drillthrough = tm1.Drillthrough;
var mdx =
"SELECT {[Month].[Month].[Jan]} ON 0, {[Region].[Region].[North]} ON 1 FROM [Sales]"
+ " WHERE ([Version].[Version].[Actual], [Measure].[Measure].[Revenue])";
var cells = ODataQuery.None().Expand(Cellset.Fields.Cells, c => c.Select(CellsetCell.Fields.Ordinal, CellsetCell.Fields.Value));
var source = await cellsets.ExecuteAsync(mdx);
try
{
var script = await drillthrough.ScriptsAsync(source.Id!, 0).OfType<CubeDrillthrough>().FirstOrDefaultAsync();
if (script is null)
{
return [];
}
var detail = await drillthrough.ExecuteAsync(source.Id!, 0, script.Name!, cells);
await cellsets.DeleteAsync(detail.Id!);
return detail.Cells!;
}
finally
{
await cellsets.DeleteAsync(source.Id!);
}
Run a drillthrough process directly, with its parameters:
// A drillthrough process run directly, with the parameters it declares
var detail = await tm1.Drillthrough.ExecuteProcessAsync(
"}Drill_Sales Detail",
[ProcessParameterPatch.Builder().Name("pRegion").Value("North").Build(), ProcessParameterPatch.Builder().Name("pMonth").Value("Jan").Build()],
ODataQuery.None().Expand(Cellset.Fields.Cells, c => c.Select(CellsetCell.Fields.Value))
);
await tm1.Cellsets.DeleteAsync(detail.Id!);
return detail.Cells!;
Read the rows of a relational drillthrough as a rowset:
// Rows from a relational drillthrough, kept as a rowset and streamed from it.
// Each row's columns are in its dynamic properties.
var drillthrough = tm1.Drillthrough;
var rowset = await drillthrough.ExecuteRelationalProcessWithRowsetAsync("}Drill_Sales Orders", []);
try
{
return await drillthrough.RowsAsync(rowset.Id!).Select(row => row.DynamicProperties!["OrderNumber"].GetString()).ToListAsync();
}
finally
{
await drillthrough.DeleteRowsetAsync(rowset.Id!);
}
Members
DrillthroughService constructor | A service that sends its requests through session. |
ScriptsAsync | The drillthroughs a cell has, streamed, each a CubeDrillthrough or RelationalDrillthrough. |
ExecuteAsync | tm1.Execute on a cell's cube drillthrough. |
ExecuteRelationalAsync | tm1.Execute on a cell's relational drillthrough. |
ExecuteRelationalWithRowsetAsync | tm1.ExecuteWithRowset on a cell's relational drillthrough. |
ExecuteProcessAsync | Runs a cube drillthrough process directly, with its parameters, and returns the cellset of the view it returns, left on the server until deleted. |
ExecuteRelationalProcessAsync | Runs a relational drillthrough process directly. |
ExecuteRelationalProcessWithRowsetAsync | Runs a relational drillthrough process directly, keeping its rows as a rowset. |
RowsetAsync | GET Rowsets('id'). |
RowsAsync | GET Rowsets('id')/Rows, streamed. |
DeleteRowsetAsync | Frees the rowset on the server. |
DrillthroughService
constructorDrillthroughService(Tm1Session session)A service that sends its requests through session.
ScriptsAsync
IAsyncEnumerable<Drillthrough> ScriptsAsync(string cellset, long ordinal, ODataQuery? query = null, CancellationToken cancellationToken = default)GET Cellsets('id')/Cells(n)/DrillthroughScripts: the drillthroughs a cell has,
streamed, each a CubeDrillthrough or RelationalDrillthrough.
TM1 REST Navigation CellsetCell/DrillthroughScripts
ExecuteAsync
Task<Cellset> ExecuteAsync( string cellset, long ordinal, string drillthrough, ODataQuery? query = null, CancellationToken cancellationToken = default )tm1.Execute on a cell's cube drillthrough: the cellset of the view its process
returns, left on the server until deleted. Needs schema 10.2.2.6. The process must take the cube's
name and one parameter per dimension (see the class description).
TM1 REST Action CubeDrillthrough/Execute
ExecuteRelationalAsync
IAsyncEnumerable<JsonElement> ExecuteRelationalAsync( string cellset, long ordinal, string drillthrough, CancellationToken cancellationToken = default )tm1.Execute on a cell's relational drillthrough: its rows, as JSON, streamed. Needs
schema 10.2.2.6.
TM1 REST Action RelationalDrillthrough/Execute
ExecuteRelationalWithRowsetAsync
Task<Rowset> ExecuteRelationalWithRowsetAsync(string cellset, long ordinal, string drillthrough, CancellationToken cancellationToken = default)tm1.ExecuteWithRowset on a cell's relational drillthrough: its rows, kept as a
rowset to read with RowsAsync. Needs schema 11.6.0.
TM1 REST Action RelationalDrillthrough/ExecuteWithRowset
ExecuteProcessAsync
Task<Cellset> ExecuteProcessAsync( string process, IReadOnlyList<ProcessParameterPatch> parameters, ODataQuery? query = null, CancellationToken cancellationToken = default )ExecuteCubeDrillthrough: runs a cube drillthrough process directly, with its
parameters, and returns the cellset of the view it returns, left on the server until deleted.
Needs schema 11.2.0.
Parameters
process- The drillthrough process's name, such as
}Drill_Sales. parameters- The process's parameters, by name and value.
TM1 REST ActionImport ExecuteCubeDrillthrough
ExecuteRelationalProcessAsync
IAsyncEnumerable<JsonElement> ExecuteRelationalProcessAsync( string process, IReadOnlyList<ProcessParameterPatch> parameters, CancellationToken cancellationToken = default )ExecuteRelationalDrillthrough: runs a relational drillthrough process directly:
its rows, as JSON, streamed. Needs schema 11.2.0.
TM1 REST ActionImport ExecuteRelationalDrillthrough
ExecuteRelationalProcessWithRowsetAsync
Task<Rowset> ExecuteRelationalProcessWithRowsetAsync( string process, IReadOnlyList<ProcessParameterPatch> parameters, CancellationToken cancellationToken = default )ExecuteRelationalDrillthroughWithRowset: runs a relational drillthrough process
directly, keeping its rows as a rowset. Needs schema 11.6.0.
TM1 REST ActionImport ExecuteRelationalDrillthroughWithRowset
RowsetAsync
Task<Rowset> RowsetAsync(string id, ODataQuery? query = null, CancellationToken cancellationToken = default)GET Rowsets('id').
TM1 REST EntitySet Rowsets
RowsAsync
IAsyncEnumerable<RowsetRow> RowsAsync(string id, ODataQuery? query = null, CancellationToken cancellationToken = default)GET Rowsets('id')/Rows, streamed: each row keeps its columns.
Parameters
id- The rowset's ID.
TM1 REST Navigation Rowset/Rows
DeleteRowsetAsync
Task DeleteRowsetAsync(string id, CancellationToken cancellationToken = default)DELETE Rowsets('id'): frees the rowset on the server.
TM1 REST EntitySet Rowsets