Eventually, it will walk through every combination of categories and return to where you started. Especially handy when added to the toolbar, just keep pushing the button to see all the layers. The majority of the Starter Scripts rely on GetFirstSelectedPivot, which requires that a pivot table be selected in the navigator before the script is run. The script affects only the first table it finds. It follows GetFirstSelectedPivot more closely than it really needs to, for the sake of novices who know and love Global.
Static variables provide the crucial functionality.
This is a minimal example, which shows how to use GetNextPivot to apply the Autofit method to all Pivot Tables. This is a script which will prevent row labels from wrapping to a new line for every Pivot Table in the current output. For each table, each column of row labels will be adjusted so that the longest label will fit on a single line. This is also a good example of how to write a script which applies to every Pivot Table in the current output document. SPSS Inc. All rights reserved.