SpssLayerLabels Class (Python)

The SpssLayerLabels class provides access to the layer labels contained in a pivot table. You need to use this object to format or change layer labels.

Layer Labels Array

The layer labels are represented as a 2-dimensional array, referred to as the layer labels array. Each row corresponds to the current category of one layer dimension. The first column is a concatenation of all the labels in the row, the second column is the dimension name, and the last column is the category label. Any columns between the second and last are group labels. You access other categories of the dimension from the SpssDimension object.

Figure 1. Layer labels displayed in a pivot table
Layer labels displayed in a pivot table
Figure 2. Layer labels array indexing
Layer labels array indexing

Each layer dimension in the layer labels array is represented by a set of levels. The first level is the dimension name, the last level contains the current category label, and all the levels in between (if any) contain group labels. Blank cells in the layer labels array indicate that there are different numbers of levels in different layer dimensions.

Getting an SpssLayerLabels Object

You get an SpssLayerLabels object from the LayerLabelArray method of an SpssPivotTable object, as in:

SpssLayerLabels = SpssPivotTable.LayerLabelArray()

Example

This example assumes that PivotTable is an SpssPivotTable object and sets the background color of the label for the first layer dimension to yellow.

LayerLabels = PivotTable.LayerLabelArray()
LayerLabels.SetBackgroundColorAt(0,65535)