PI04902: SETVALUEAT API DOES NOT SET DECIMAL TO COMMA IN NEW PIVOT TABLE ALTHOUGH LOCALE IS CZECH

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as user error.

Error description

  • You work with Statistics 22 on Czech locale which normally use
    COMMA instead of DOT as decimal separator on pivot tables. You
    run the below Python command with SetValueAt API to create a new
    pivot table:
    
    dataset close all.
    new file.
    set unicode = OFF.
    SET LOCALE='cs_cz'.
    
    BEGIN PROGRAM.
    import SpssClient
    SpssClient.StartClient()
    
    objOutputDoc = SpssClient.GetDesignatedOutputDoc()
    index=objOutputDoc.InsertTable("Title",1,3,0)
    objOutputItems=objOutputDoc.GetOutputItems()
    objOutputItem=objOutputItems.GetItemAt(index)
    objPivotTable = objOutputItem.GetSpecificType()
    
    objDataCells = objPivotTable.DataCellArray()
    for j in range(3):
    objDataCells.SetValueAt(0,j,str(j))
    objDataCells.SetNumericFormatAtWithDecimal(0,j,"#.#",1)
    
    SpssClient.StopClient()
    END PROGRAM.
    
    However, on the created pivot table on outputviewer you see
    values of
    .0 - 1.0 - 2.0 instead of ,0 - 1,0 - 2,0
    
    You expect a Comma for this table created with API SetValueAt.
    This was reported to IBM SPSS development.
    

Local fix

  • This is not a defect. Run the below syntax instead.
    The only difference is line 14:
    objDataCells.SetNumericFormatAtWithDecimal(0,j,"#.###,##",1)
    The user need to use the format "#.###,##" to indicate that
    using the comma as the decimal separator; and using the dot as
    group separator.
    When you run the below corrected syntax you get comma as decimal
    separator in a pivot table within release 22 when using Czech
    locale.
    
    BEGIN PROGRAM.
    import SpssClient
    SpssClient.StartClient()
    
    objOutputDoc = SpssClient.GetDesignatedOutputDoc()
    index=objOutputDoc.InsertTable("Title",1,3,0)
    objOutputItems=objOutputDoc.GetOutputItems()
    objOutputItem=objOutputItems.GetItemAt(index)
    objPivotTable = objOutputItem.GetSpecificType()
    
    objDataCells = objPivotTable.DataCellArray()
    for j in range(3):
      objDataCells.SetValueAt(0,j,str(j))
      objDataCells.SetNumericFormatAtWithDecimal(0,j,"#.###,##",1)
    
    SpssClient.StopClient()
    END PROGRAM.
    

Problem summary

Problem conclusion

Temporary fix

Comments

  • This is not a defect. Run the below syntax instead.
    The only difference is line 14:
    objDataCells.SetNumericFormatAtWithDecimal(0,j,"#.###,##",1)
    The user need to use the format "#.###,##" to indicate that
    using the comma as the decimal separator; and using the dot as
    group separator.
    When you run the below corrected syntax you get comma as decimal
    separator in a pivot table within release 22 when using Czech
    locale.
    
    BEGIN PROGRAM.
    import SpssClient
    SpssClient.StartClient()
    
    objOutputDoc = SpssClient.GetDesignatedOutputDoc()
    index=objOutputDoc.InsertTable("Title",1,3,0)
    objOutputItems=objOutputDoc.GetOutputItems()
    objOutputItem=objOutputItems.GetItemAt(index)
    objPivotTable = objOutputItem.GetSpecificType()
    
    objDataCells = objPivotTable.DataCellArray()
    for j in range(3):
      objDataCells.SetValueAt(0,j,str(j))
      objDataCells.SetNumericFormatAtWithDecimal(0,j,"#.###,##",1)
    
    SpssClient.StopClient()
    END PROGRAM.
    

APAR Information

  • APAR number

    PI04902

  • Reported component name

    SPSS STATISTICS

  • Reported component ID

    5725A54ST

  • Reported release

    M00

  • Status

    CLOSED USE

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-28

  • Closed date

    2013-12-18

  • Last modified date

    2013-12-18

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

Applicable component levels



Rate this page:

(0 users)Average rating

Document information


More support for:

SPSS Statistics
Statistics Desktop

Software version:

22.0

Reference #:

PI04902

Modified date:

2013-12-18

Translate my page

Machine Translation

Content navigation