Home > @activeviam/activeui-sdk > TableFromCellSet
TableFromCellSet type
Convert a CellSet to a Table data representation.
Signature:
export declare type TableFromCellSet = (cellSet: CellSet, cubeDiscovery: CubeDiscovery, translator: Translator, sourceId: SourceId, dataVersion?: TableVersion, prevCellSet?: CellSet) => Table;
Remarks
There are two distinct types of columns that appear when looking at a pivot table displaying a cellSet:
- columns containing the
ROWS
axis headers - columns containing the cells
The columns containing the ROWS
axis are converted to as many columns as there are levels expressed in the members on the ROWS
axis. So even if there is a single hierarchy in the MDX query, the output Table can contain multiple columns. These columns are level columns, so their TableHeader is of the form:
{
isNumeric: false,
captions: ['theLevelCaption'],
value: 'theLevelUniqueName'
}
The other columns are measures columns. We create one column per column you see in the pivot table. If some cells of the cellSet are not defined because the underlying measure did not return any value, the TableCell of the corresponding line will contain an EmptyTableCell at this position. The TableHeader for this kind of columns is more complex. This is because it needs to represent the MDX coordinates of the given column.
If there is no CrossJoin
on the COLUMNS
axis, the header will be straightforward, and be like:
{
isNumeric: true,
captions: ['Count'],
value: '[Measures].[contributors.COUNT]'
}
But if the user CrossJoined
the measures with a hierarchy, like *Desk* with 2 members on the second level *DeskA* and *DeskB*, and then 10 *Book* members below, we will have 20 columns, with headers like:
{
isNumeric: true,
captions: ['Desk A', '2', 'Count'],
value: '([AllMember].[DeskA].[2],[Measures].[contributors.COUNT])'
}
Tables can also contain a third PAGES
axis. It can be used to show the evolution of some values. For example one could compare values across time. When this axis is used, cells from the regular two-dimensional table are enriched with a pagesCell
attribute. This attribute is an array of the different values that are taken from a given {row, column} coordinate along the PAGES
axis. For example, suppose you are looking at the following MDX query:
SELECT
NON EMPTY [Measures].[pnl.SUM] ON COLUMNS,
NON EMPTY Hierarchize(
DrilldownLevel(
[Currency].[Currency].[ALL].[AllMember]
)
) ON ROWS,
NON EMPTY Hierarchize(
[Time].[HistoricalDates].[AsOfDate].Members
) ON PAGES
FROM [EquityDerivativesCube]
Then table.content[1][1]
is the cell object representing the PnL for the EUR currency. On that cell, cell.pages
will yield the different values that this PnL takes through time, wrapped themselves in a cell object of the form {value: 10000, caption: "10, 000", [...]}
. To understand which date corresponds to each of these pages cells, one can look at the pagesHeaders
accessible through table.pagesHeaders
, which work just like regular column headers.