LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2005)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 10 Sep 2005 09:45:41 -0300
Reply-To:     "Chris A. McGibbon" <cmcgibb@nb.sympatico.ca>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Chris A. McGibbon" <cmcgibb@nb.sympatico.ca>
Subject:      SPSS Script help: hiding dimension and layer labels
Content-Type: text/plain; charset="iso-8859-1"

Hello,

I'm working on a project to generate case reports from an SPSS data file.

To get started, I wrote a script to generate a pivot table with the desired format/fonts/look etc. Eventually the data cells of the table will be populated with data from an SPSS data file.

In the pivot table I have generated, I want to hide the column and layer dimension labels. I've coded this into the script (see below), but it doesn't seem to work.

Below is a sample script that generates a simple pivot table with 7 data rows and 1 data column. For now the data cells are populated with blanks (" ").

When I run the script, the column dimension label, and the layer dimension label, remain... even though I have coded them to be hidden.

---------------------------------------------------------------------------- ----------------------------------------------------- Sub Main Dim objOutputDoc As ISpssOutputDoc Dim objColumnDim As ISpssDimension Dim objLabels As ISpssLabels Dim objLayerLabels As ISpssLayerLabels Dim objItems As ISpssItems Dim objItem As ISpssItem Dim objPivotTable As PivotTable Dim objDataCells As ISpssDataCells Dim objPivMgr As ISpssPivotMgr Dim objLayerDim As ISpssDimension Dim index As Long Dim intCol As Long ' Number of columns in label array. Dim intRow As Long ' Number of rows in label array Dim intR As Long ' Loop Counter Dim intC As Long ' Loop Counter

' Create a new Viewer window and make it visible Set objOutputDoc = objSpssApp.NewOutputDoc objOutputDoc.Visible = True

'''''''''' CREATE EMPTY DEMOGRAPHICS TABLE '''''''''''

' Insert a blank table for demographic info (7 rows, 1 column) index = objOutputDoc.InsertTable( "Table 1", 7,1,1) Set objItems = objOutputDoc.Items Set objItem = objItems.GetItem(objItems.Count-1) objItem.Align = SpssAlignCenter

Set objPivotTable = objItem.Activate objPivotTable.UpdateScreen=False objPivotTable.TitleText="PHYSICAL FITNESS ASSESSMENT"

' Hide table layer information -- ***THIS APPEARS TO HAVE NO EFFECT, WHY?*** Set objPivMgr = objPivotTable.PivotManager Set objLayerDim = objPivMgr.LayerDimension(0) objLayerDim.HideLabel

' Hide dimension labels -- ***THIS APPEARS TO HAVE NO EFFECT, WHY?*** Set objPivMgr = objPivotTable.PivotManager Set objColumnDim = objPivMgr.ColumnDimension(0) objColumnDim.HideLabel

' Set column labels Set objLabels = objPivotTable.ColumnLabelArray objLabels.ValueAt(1,0) = " " objLabels.ColumnLabelWidthAt(1,0) = 180

' Set row labels Set objLabels = objPivotTable.RowLabelArray objLabels.RowLabelWidthAt(0,1) = 85 objLabels.ValueAt(0,1) = "District" objLabels.ValueAt(1,1) = "School" objLabels.ValueAt(2,1) = "Student Name" objLabels.ValueAt(3,1) = "Date of Birth" objLabels.ValueAt(4,1) = "Age" objLabels.ValueAt(5,1) = "Grade" objLabels.ValueAt(6,1) = "Gender"

' Set data (just blanks for now) Set objDataCells = objPivotTable.DataCellArray intCol = objDataCells.NumColumns intRow = objDataCells.NumRows For intC = 0 To intCol - 1 For intR = 0 To intRow - 1 objDataCells.ValueAt(intR,intC) = " " Next intR Next intC

' Finish up objPivotTable.UpdateScreen=True objItem.Deactivate

End Sub ---------------------------------------------------------------------------- -----------------------------------------------------

Can someone help me solve this (relatively minor but) frustrating problem!

Many thanks in advance, Chris

****************************************** Chris A. McGibbon, PhD http://www.stats-consult.com


Back to: Top of message | Previous page | Main SPSSX-L page