Skip to main content
An Atoti cube can be queried in multiple ways, including - most commonly - via the MDX query language. MDX is suitable for most business use cases, but behind the scene the Atoti MDX engine interprets MDX queries and decomposes them into more “primitive” queries that are defined in terms of cube locations. This article describes the low-level API that supports the location-based queries implemented in Atoti Server.
Throughout this article, we assume that a cube instance is accessible through a variable named pivot (we don’t discuss the type of cube instance we are dealing with or how to get it, as this is not the focus of this article). It is also assumed that the cube includes four hierarchies: Currency (AllMember enabled), Date (AllMember disabled), Trader (AllMember enabled) and Maturity (AllMember enabled).

GetAggregatesQuery

The goal of the GetAggregatesQuery (GAQ) is to retrieve all the aggregates that are defined by a set of locations and aggregated measures. The following code block illustrates a GAQ querying all the locations with “EUR” as currency, and requesting the aggregated measures “Quantity.SUM” and “PositionValue.SUM”. The queryResults contains the locations with the aggregated measures (together with their values) for each location.

DrillthroughQuery

A drillthrough query returns all the facts that have contributed to a range of selected locations. In the example below, we query all the projections that contributed to all “EUR” locations.

Local Registration of a Location-Based Continuous Query

A GetAggregatesQuery or a DrillthroughQuery can be registered as a continuous query:
The listener(s) specified on registration must be compatible with the type of query. Namely, IGetAggregatesContinuousQueryListener (shortcut for IContinuousQueryListener<ICellSet, IVersionedContinuousQueryUpdate<ICellSet>>) for a GetAggregatesQuery, or IContinuousQueryListener<List<IDrillthroughRow>, IContinuousQueryUpdate<List<IDrillthroughRow>>> for a DrillthroughQuery. Here is an example of a simple printing listener for a GetAggregatesQuery:
The query name specified at registration time can be used to unregister the continuous query.