Class DrillthroughService
}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(String, long, ODataQuery) 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(String, List, ODataQuery)), 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()));
-
Constructor Summary
ConstructorsConstructorDescriptionDrillthroughService(Tm1Session session) A service sending its requests throughsession. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void> deleteRowset(String id) DELETE Rowsets('id'): frees the rowset on the server.reactor.core.publisher.Mono<Cellset> execute(String cellset, long ordinal, String drillthrough, ODataQuery query) tm1.Executeon a cell's cube drillthrough: the cellset of the view its process returns, left on the server until deleted.reactor.core.publisher.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.reactor.core.publisher.Flux<tools.jackson.databind.JsonNode> executeRelational(String cellset, long ordinal, String drillthrough) tm1.Executeon a cell's relational drillthrough: its rows, streamed.reactor.core.publisher.Flux<tools.jackson.databind.JsonNode> executeRelationalProcess(String process, List<ProcessParameterPatch> parameters) ExecuteRelationalDrillthrough: runs a relational drillthrough process directly.reactor.core.publisher.Mono<Rowset> executeRelationalProcessWithRowset(String process, List<ProcessParameterPatch> parameters) ExecuteRelationalDrillthroughWithRowset: runs a relational drillthrough process directly, keeping its rows as a rowset.reactor.core.publisher.Mono<Rowset> executeRelationalWithRowset(String cellset, long ordinal, String drillthrough) tm1.ExecuteWithRowseton a cell's relational drillthrough: its rows, kept as a rowset to read withrows(String, ODataQuery).reactor.core.publisher.Flux<RowsetRow> rows(String id, ODataQuery query) GET Rowsets('id')/Rows, streamed: each row's columns are in itsdynamicProperties.reactor.core.publisher.Mono<Rowset> rowset(String id, ODataQuery query) GET Rowsets('id').reactor.core.publisher.Flux<Drillthrough> scripts(String cellset, long ordinal, ODataQuery query) GET Cellsets('id')/Cells(n)/DrillthroughScripts: the drillthroughs a cell has, streamed, each aCubeDrillthroughorRelationalDrillthrough.
-
Constructor Details
-
DrillthroughService
A service sending its requests throughsession.- Parameters:
session- the session
-
-
Method Details
-
scripts
@Tm1Endpoint("Navigation CellsetCell/DrillthroughScripts") public reactor.core.publisher.Flux<Drillthrough> scripts(String cellset, long ordinal, ODataQuery query) GET Cellsets('id')/Cells(n)/DrillthroughScripts: the drillthroughs a cell has, streamed, each aCubeDrillthroughorRelationalDrillthrough.- Parameters:
cellset- the cellset's IDordinal- the cell's ordinalquery- what to select- Returns:
- the drillthroughs, by name
-
execute
@Tm1Endpoint("Action CubeDrillthrough/Execute") public reactor.core.publisher.Mono<Cellset> execute(String cellset, long ordinal, String drillthrough, ODataQuery query) tm1.Executeon 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 IDordinal- the cell's ordinaldrillthrough- the drillthrough's name, fromscripts(String, long, ODataQuery)query- what to expand of the cellset- Returns:
- the cellset
-
executeRelational
@Tm1Endpoint("Action RelationalDrillthrough/Execute") public reactor.core.publisher.Flux<tools.jackson.databind.JsonNode> executeRelational(String cellset, long ordinal, String drillthrough) tm1.Executeon a cell's relational drillthrough: its rows, streamed. Needs schema 10.2.2.6.- Parameters:
cellset- the cellset's IDordinal- the cell's ordinaldrillthrough- the drillthrough's name, fromscripts(String, long, ODataQuery)- Returns:
- the rows, as JSON
-
executeRelationalWithRowset
@Tm1Endpoint("Action RelationalDrillthrough/ExecuteWithRowset") public reactor.core.publisher.Mono<Rowset> executeRelationalWithRowset(String cellset, long ordinal, String drillthrough) tm1.ExecuteWithRowseton a cell's relational drillthrough: its rows, kept as a rowset to read withrows(String, ODataQuery). Needs schema 11.6.0.- Parameters:
cellset- the cellset's IDordinal- the cell's ordinaldrillthrough- the drillthrough's name, fromscripts(String, long, ODataQuery)- Returns:
- the rowset, with its
ID
-
executeProcess
@Tm1Endpoint("ActionImport ExecuteCubeDrillthrough") public reactor.core.publisher.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_Salesparameters- the process's parameters, by name and valuequery- what to expand of the cellset- Returns:
- the cellset, left on the server until deleted
-
executeRelationalProcess
@Tm1Endpoint("ActionImport ExecuteRelationalDrillthrough") public reactor.core.publisher.Flux<tools.jackson.databind.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 nameparameters- the process's parameters- Returns:
- the rows, as JSON, streamed
-
executeRelationalProcessWithRowset
@Tm1Endpoint("ActionImport ExecuteRelationalDrillthroughWithRowset") public reactor.core.publisher.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 nameparameters- the process's parameters- Returns:
- the rowset, with its
ID
-
rowset
@Tm1Endpoint("EntitySet Rowsets") public reactor.core.publisher.Mono<Rowset> rowset(String id, ODataQuery query) GET Rowsets('id').- Parameters:
id- the rowset's IDquery- what to expand- Returns:
- the rowset
-
rows
@Tm1Endpoint("Navigation Rowset/Rows") public reactor.core.publisher.Flux<RowsetRow> rows(String id, ODataQuery query) GET Rowsets('id')/Rows, streamed: each row's columns are in itsdynamicProperties.- Parameters:
id- the rowset's IDquery- what to select, filter, and page ($top,$skip)- Returns:
- the rows
-
deleteRowset
DELETE Rowsets('id'): frees the rowset on the server.- Parameters:
id- the rowset's ID- Returns:
- completes when it's deleted
-