Append Method (Python)
.Append(place,dimName,hideName, hideLabels). Appends
row, column, and layer dimensions to a pivot table. You use this
method, or the Insert method, to create the dimensions associated
with a custom pivot table. The argument place specifies the
type of dimension: spss.Dimension.Place.row
for a
row dimension, spss.Dimension.Place.column
for a
column dimension, and spss.Dimension.Place.layer
for
a layer dimension. The argument dimName is a string that specifies
the name used to label this dimension in the displayed table. Each
dimension must have a unique name. The argument hideName specifies
whether the dimension name is hidden--by default, it is displayed.
Use hideName=True
to hide the name. The argument hideLabels specifies
whether category labels for this dimension are hidden--by default,
they are displayed. Use hideLabels=True
to hide category
labels.
- The order in which dimensions are appended affects how they are displayed in the resulting table. Each newly appended dimension of a particular type (row, column, or layer) becomes the current innermost dimension in the displayed table, as shown in the example below.
- The order in which dimensions are created (with the
Append
orInsert
method) determines the order in which categories should be specified when providing the dimension coordinates for a particular cell (used when Setting Cell Values or adding Footnotes). For example, when specifying coordinates using an expression such as(category1,category2)
, category1 refers to the dimension created by the first call toAppend
orInsert
, and category2 refers to the dimension created by the second call toAppend
orInsert
.
Example
table = spss.BasePivotTable("Table Title",
"OMS table subtype")
coldim=table.Append(spss.Dimension.Place.column,"coldim")
rowdim1=table.Append(spss.Dimension.Place.row,"rowdim-1")
rowdim2=table.Append(spss.Dimension.Place.row,"rowdim-2")

Examples of using the Append
method are most easily
understood in the context of going through the steps to create a pivot
table. See the topic General Approach to Creating Pivot Tables (Python) for more information.