Share via


Navigating Cells in a Dataset

After the structure of the axes is known, the application can navigate the cells in the dataset. Navigation is the process of traversing through the various cells in the dataset and zeroing in on the desired set of cells. To do this, there must be a way to refer to cells that determines their relative position in the dataset. In OLE DB for OLAP, there are three modes of navigation.

Navigating by cell ordinal, the application simply refers to the ordinal number of the desired cell (or the starting cell of the desired set of cells). OLE DB for OLAP assigns each coordinate (tuple) on an axis a number, called a tuple ordinal, starting from zero and increasing rightward along the axis. OLAP also defines an algorithm for assigning a unique ordinal to each cell in a dataset, given the tuple ordinals of its coordinates. The method IMDDataset::GetCellData takes as arguments the cell ordinals of the starting cell and the ending cell of the desired range. It then returns those cells contained in the slice of the dataset bounded by the starting cell at its upper left corner and the ending cell at its lower right corner.

Navigating by axes coordinates, the application identifies a cell by identifying the tuple on each axis at the intersection of which the cell lies. These are the set of coordinates that identify the desired cells. For example, the application specifies the cell at the intersection of the coordinates (5, 3, 2) (5th coordinate on the x-axis, 3rd coordinate on the y-axis, and 2nd coordinate on the z-axis).

OLE DB for OLAP defines the method IMDFind::FindTuple, which takes in a set of members (which form the constituents of the desired tuple) and returns the tuple ordinal. The application can make multiple calls to this method to find the tuple ordinal of each coordinate, use the algorithm in OLE DB for OLAP to derive the cell ordinal, and call IMDDataset::GetCellData. The tuple ordinal for each tuple on an axis is also available in the axis rowset.

Navigating by member names is a variation on the previous method. The application identifies a cell by a set of members in a tuple. Each tuple's constituent parts are used to identify the desired cells. For example, the application might request the data value for Sales in USA for 1992, Qtr1, for all SalesReps. In a sense, this is the natural way to think about the cells in a dataset.

Two OLE DB for OLAP methods are used to navigate by member names: IMDFind::FindCell takes an array of members and a starting cell ordinal and returns the corresponding cell ordinal; then the IMDDataset::GetCellData method gets the cell data.

For more information about the formula used to derive a cell ordinal given its tuple ordinals, see the description of IMDDataset::GetCellData in the interface reference section.