toString Method (Python)

This method is used to obtain a string representation of a CellText.String or CellText.Number object. Values obtained from this method can be used in string expressions. You call this method on a CellText.String or CellText.Number object.

Example

from spss import CellText
table = spss.BasePivotTable("Table Title",
                            "OMS table subtype")

table.Append(spss.Dimension.Place.row,"row dimension")
table.Append(spss.Dimension.Place.column,"column dimension")

row_cat1 = CellText.String("first row")
row_cat2 = CellText.String("second row")
col_cat1 = CellText.String("first column")
col_cat2 = CellText.String("second column")

table[(row_cat1,col_cat1)] = CellText.String("abc")
cellValue = table[(row_cat1,col_cat1)].toString()
table[(row_cat2,col_cat2)] = CellText.String(cellValue + "d")
  • table[(row_cat1,col_cat1)].toString() returns a string representation of the CellText object (recall that table cells are stored as CellText objects) for the cell with category values ("first row","first column").