DrillthroughService
import io.skipcheck.tm1.client.service.data.DrillthroughService; 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; scripts 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 (executeProcess), 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.
CellsetService cellsets = tm1.cellsets();
DrillthroughService drillthrough = tm1.drillthrough();
String mdx = "SELECT {[Month].[Month].[Jan]} ON 0, {[Region].[Region].[North]} ON 1 FROM [Sales]"
+ " WHERE ([Version].[Version].[Actual], [Measure].[Measure].[Revenue])";
ODataQuery cells = ODataQuery.none()
.expand(Cellset.CELLS, c -> c.select(CellsetCell.ORDINAL, CellsetCell.VALUE));
return Flux.usingWhen(cellsets.execute(mdx, ODataQuery.none()),
source -> drillthrough.scripts(source.id(), 0, ODataQuery.none())
.filter(CubeDrillthrough.class::isInstance)
.next()
.flatMapMany(script -> Flux.usingWhen(drillthrough.execute(source.id(), 0, script.name(), cells),
detail -> Flux.fromIterable(detail.cells()), detail -> cellsets.delete(detail.id()))),
source -> cellsets.delete(source.id()));
Run a drillthrough process directly, with its parameters:
// A drillthrough process run directly, with the parameters it declares
CellsetService cellsets = tm1.cellsets();
List<ProcessParameterPatch> parameters = List.of(
ProcessParameterPatch.builder().name("pRegion").value("North").build(),
ProcessParameterPatch.builder().name("pMonth").value("Jan").build());
return Flux.usingWhen(
tm1.drillthrough()
.executeProcess("}Drill_Sales Detail", parameters,
ODataQuery.none().expand(Cellset.CELLS, c -> c.select(CellsetCell.VALUE))),
detail -> Flux.fromIterable(detail.cells()), detail -> cellsets.delete(detail.id()));
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.
DrillthroughService drillthrough = tm1.drillthrough();
return Flux.usingWhen(drillthrough.executeRelationalProcessWithRowset("}Drill_Sales Orders", List.of()),
rowset -> drillthrough.rows(rowset.id(), ODataQuery.none())
.map(row -> row.dynamicProperties().get("OrderNumber").asString()),
rowset -> drillthrough.deleteRowset(rowset.id()));
Members
DrillthroughService constructor | A service sending its requests through session. |
scripts | The drillthroughs a cell has, streamed, each a CubeDrillthrough or RelationalDrillthrough. |
execute | tm1.Execute on a cell's cube drillthrough. |
executeRelational | tm1.Execute on a cell's relational drillthrough. |
executeRelationalWithRowset | tm1.ExecuteWithRowset on a cell's relational drillthrough. |
executeProcess | Runs a cube drillthrough process directly, with its parameters, and returns the cellset of the view it returns. |
executeRelationalProcess | Runs a relational drillthrough process directly. |
executeRelationalProcessWithRowset | Runs a relational drillthrough process directly, keeping its rows as a rowset. |
rowset | GET Rowsets('id'). |
rows | GET Rowsets('id')/Rows, streamed. |
deleteRowset | Frees the rowset on the server. |
DrillthroughService
constructorDrillthroughService(Tm1Session session) A service sending its requests through session.
Parameters
session- the session
scripts
Flux<Drillthrough> scripts(String cellset, long ordinal, ODataQuery query) GET Cellsets('id')/Cells(n)/DrillthroughScripts: the drillthroughs a cell
has, streamed, each a CubeDrillthrough or RelationalDrillthrough.
Parameters
cellset- the cellset's ID
ordinal- the cell's ordinal
query- what to select
Returns
- the drillthroughs, by name
TM1 REST Navigation CellsetCell/DrillthroughScripts
execute
Mono<Cellset> execute(String cellset, long ordinal, String drillthrough, ODataQuery query) 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).
Parameters
cellset- the cellset's ID
ordinal- the cell's ordinal
drillthrough- the drillthrough's name, from
scripts query- what to expand of the cellset
Returns
- the cellset
TM1 REST Action CubeDrillthrough/Execute
executeRelational
Flux<JsonNode> executeRelational(String cellset, long ordinal, String drillthrough) tm1.Execute on a cell's relational drillthrough: its rows, streamed. Needs
schema 10.2.2.6.
Parameters
cellset- the cellset's ID
ordinal- the cell's ordinal
drillthrough- the drillthrough's name, from
scripts
Returns
- the rows, as JSON
TM1 REST Action RelationalDrillthrough/Execute
executeRelationalWithRowset
Mono<Rowset> executeRelationalWithRowset(String cellset, long ordinal, String drillthrough) tm1.ExecuteWithRowset on a cell's relational drillthrough: its rows, kept
as a rowset to read with rows. Needs schema 11.6.0.
Parameters
cellset- the cellset's ID
ordinal- the cell's ordinal
drillthrough- the drillthrough's name, from
scripts
Returns
- the rowset, with its
ID
TM1 REST Action RelationalDrillthrough/ExecuteWithRowset
executeProcess
Mono<Cellset> executeProcess(String process, List<ProcessParameterPatch> parameters, ODataQuery query) ExecuteCubeDrillthrough: runs a cube drillthrough process directly, with
its parameters, and returns the cellset of the view it returns. 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
query- what to expand of the cellset
Returns
- the cellset, left on the server until deleted
TM1 REST ActionImport ExecuteCubeDrillthrough
executeRelationalProcess
Flux<JsonNode> executeRelationalProcess(String process, List<ProcessParameterPatch> parameters) ExecuteRelationalDrillthrough: runs a relational drillthrough process
directly. Needs schema 11.2.0.
Parameters
process- the drillthrough process's name
parameters- the process's parameters
Returns
- the rows, as JSON, streamed
TM1 REST ActionImport ExecuteRelationalDrillthrough
executeRelationalProcessWithRowset
Mono<Rowset> executeRelationalProcessWithRowset(String process, List<ProcessParameterPatch> parameters) ExecuteRelationalDrillthroughWithRowset: runs a relational drillthrough
process directly, keeping its rows as a rowset. Needs schema 11.6.0.
Parameters
process- the drillthrough process's name
parameters- the process's parameters
Returns
- the rowset, with its
ID
TM1 REST ActionImport ExecuteRelationalDrillthroughWithRowset
rowset
Mono<Rowset> rowset(String id, ODataQuery query) GET Rowsets('id').
Parameters
id- the rowset's ID
query- what to expand
Returns
- the rowset
TM1 REST EntitySet Rowsets
rows
Flux<RowsetRow> rows(String id, ODataQuery query) GET Rowsets('id')/Rows, streamed: each row's columns are in its
dynamicProperties.
Parameters
id- the rowset's ID
query- what to select, filter, and page (
$top,$skip)
Returns
- the rows
TM1 REST Navigation Rowset/Rows
deleteRowset
Mono<Void> deleteRowset(String id) DELETE Rowsets('id'): frees the rowset on the server.
Parameters
id- the rowset's ID
Returns
- completes when it's deleted
TM1 REST EntitySet Rowsets
Also in the Javadoc.