Hi,
Given the code snippet below it takes 3 minutes to get the requested DataCells object when applied to a PivotTable consisting of 1500 rows.
When applied to a much smaller PivotTable the result is immediate.
The calling syntax includes the line:
set TABLERENDER = FULL.
I'm using SPSS 25.0.0.2 and Python 2.7.18
Help in getting output faster would be greatly appreciated.
Thanks
Kees Smit
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
def getTable (outputDoc, tableNr):
# If tableNr == 3 then the third PivotTable in outputDoc will be returned
objItems = outputDoc.GetOutputItems()
maxNumber = objItems.Size()
numberFound = 0
for outputItem in range (maxNumber):
item = objItems.GetItemAt(outputItem)
if item.GetType()== SpssClient.OutputItemType.PIVOT:
numberFound +=1
if numberFound == tableNr:
break
item = objItems.GetItemAt(outputItem)
objPivotTable = item.GetSpecificType()
return objPivotTable
myPivot = getTable (outputDoc,tableNr)
#This try: except clause does not help
try:
if myPivot.IsLegacyTableCompatible():
myPivot.SetLegacyTableCompatible(False)
except:
pass
dataCells = myPivot.DataCellArray()
------------------------------
Kees Smit
------------------------------
#SPSSStatistics