Partager via


Finding and Returning Slicer Information

Every dimension in the cube is either an axis dimension or a slicer dimension. For the purposes of returning slicer dimension information, the set of slicer dimensions is treated as if it were on a special axis, called the slicer axis. Slicer axis information is returned by the MDAXISINFO structure. In the following illustration, the slicer dimension is Time with "1991" as the selected member.

SalesData cube with multiple dimensions

Finding Slicer Information

As it does for any other axis, the MDAXISINFO structure returns information about the slicer axis. The cDimensions field contains the number of slicer dimensions; cCoordinates is 1 for most providers because the slicer for most providers is just one tuple. The rgpwszDimensionNames value points to the array containing the names of all slicer dimensions, and rgcColumns points to the array containing the number of columns corresponding to each slicer dimension on the axis rowset. The axis rowset for the slicer dimension usually has just one row because most providers support only one tuple for a slicer.

The slicer axis rowset for the SalesData Example is shown in the following table. Because the rowset has 16 columns and all will not fit on the same page, only the MEMBER_UNIQUE_NAME and LEVEL_UNIQUE_NAME columns are shown for each dimension.

partial slicer axis rowset for SalesData

Note

MEASURES_LEVEL is just "Measures," the name of the dimension itself. This is because, in the example, there was no hierarchy in this dimension, so the level name was a dummy name made up by the provider. It used the name of the dimension itself to create the dummy name. On the other hand, the name of the TIME_LEVEL is "Years" because it reflects a specific Time dimension hierarchy. Also, it is assumed that "Sales" and "[1991]" are unique and therefore do not need to be qualified.

The columns for each slicer dimension are available in the order that these dimensions are listed in the rgpwszDimensionNames array. This order is not necessarily the same as the order of dimensions as inferred from the members constituting the slicer tuple. For example, if the slicer tuple is ([Measures].[Sales], [Years].[1991], [Products].[All]) and if rgpwszDimensionNames is [Years, Measures, Products], then the columns for the Years dimension come first, followed by those for Measures and Products. Consumers should not derive column order from the slicer tuple; rather, they should derive it from the dimension name array of MDAXISINFO.

Returning Slicer Information

After finding how the axes are laid out, the next step is to find out the structure of the slicer dimensions and which members are chosen from the slicer dimensions. For the purposes of axis ordering, the slicer axis is assumed to come after all other axes. The identifier for the slicer axis is MDAXIS_SLICERS and is defined to be the constant 0xffffffff, the largest ULONG (32-bit) value possible.

As it does for any other axis, the MDAXISINFO structure returns information about the slicer axis. The cDimensions field contains the number of slicer dimensions; cCoordinates is 1 for most providers because the slicer for most providers is just one tuple. The rgpwszDimensionNames array contains the names of all slicer dimensions, and rgcColumns contains the number of columns corresponding to each slicer dimension on the axis rowset. The axis rowset for the slicer dimension usually has just one row because most providers support only one tuple for a slicer.