|
Hi, if I want to walk through
the items in a Outputdoc, I can do that without problems with a range command. However, walking backwards,
that is, starting at the last item, makes python crash. Is there a way I can access
the last pivot table in the output without going through all the items I have in
my Outputdoc. I use SPSS 18.1 Thanks in advances Christian ********************** This example works: ********************** import SpssClient SpssClient.StartClient() OutputDoc = SpssClient.GetDesignatedOutputDoc() OutputItems = OutputDoc.GetOutputItems() i = OutputItems.Size()
#counts the items for index in range(i): OutputItem = OutputItems.GetItemAt(index) print
OutputItem.GetType() SpssClient.StopClient() Prints: SpssClient.OutputItemType.ROOT SpssClient.OutputItemType.LOG SpssClient.OutputItemType.HEAD SpssClient.OutputItemType.TITLE SpssClient.OutputItemType.NOTE SpssClient.OutputItemType.WARNING SpssClient.OutputItemType.PIVOT ********************** This example crashes: ********************** import SpssClient SpssClient.StartClient() OutputDoc =
SpssClient.GetDesignatedOutputDoc() OutputItems =
OutputDoc.GetOutputItems() i = OutputItems.Size()
#counts the items #for index in range(i,0,-1): OutputItem = OutputItems.GetItemAt(index) print
OutputItem.GetType() SpssClient.StopClient() ********************************** Christian Schmidhauser, Dr.phil.II |
|
|
In reply to this post by la volta statistics
Size() returns the number of items. They are numbered from zero, though, so this code i = OutputItems.Size() #counts the items #for index in range(i,0,-1): OutputItem = OutputItems.GetItemAt(index) is asking for an item 1 beyond the end. BOOM! Jon Peck SPSS, an IBM Company [hidden email] 312-651-3435
Hi, if I want to walk through the items in a Outputdoc, I can do that without problems with a range command. However, walking backwards, that is, starting at the last item, makes python crash. Is there a way I can access the last pivot table in the output without going through all the items I have in my Outputdoc. I use SPSS 18.1 Thanks in advances Christian ********************** This example works: ********************** import SpssClient SpssClient.StartClient() OutputDoc = SpssClient.GetDesignatedOutputDoc() OutputItems = OutputDoc.GetOutputItems() i = OutputItems.Size() #counts the items for index in range(i): OutputItem = OutputItems.GetItemAt(index) print OutputItem.GetType() SpssClient.StopClient() Prints: SpssClient.OutputItemType.ROOT SpssClient.OutputItemType.LOG SpssClient.OutputItemType.HEAD SpssClient.OutputItemType.TITLE SpssClient.OutputItemType.NOTE SpssClient.OutputItemType.WARNING SpssClient.OutputItemType.PIVOT ********************** This example crashes: ********************** import SpssClient SpssClient.StartClient() OutputDoc = SpssClient.GetDesignatedOutputDoc() OutputItems = OutputDoc.GetOutputItems() i = OutputItems.Size() #counts the items #for index in range(i,0,-1): OutputItem = OutputItems.GetItemAt(index) print OutputItem.GetType() SpssClient.StopClient() ********************************** la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:schmidhauser@... Web: www.lavolta.ch |
| Free forum by Nabble | Edit this page |
