Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 


#Product
#Analytics
#CognosAnalytics
#Analyticstools
#TechXchange Partner
#TechXchange Session
#TechXchange Presenter
#AI
 View Only
  • 1.  Formatting Data Column with Pattern

    Posted 12/06/19 12:39 PM
    Hello,

    I am trying to format an integer column to have 8 characters, padded by leading zeros.
    I have tried:
    1. Right clicking on the column in my Data Module
    2. Selecting 'Format Data'
    3. Format Type = Number
    4. Go To 'Advanced Options'
    5. Navigate to 'Other' tab
    6. Enter '0' in the Padding Character field
    7. Enter '00000000' in the Pattern field
    Expected: Numbers are shown with leading zeros if under 8 characters.
    Actual: No changes observed to the data in the column.

    I also tried creating a calculation with the following formula but received errors when evaluating:
    format( column name, "00000000")

    Any guidance would be much appreciated!

    Best,
    Sam

    ------------------------------
    Samuel Lane
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Formatting Data Column with Pattern

    Posted 12/06/19 02:18 PM
    Hi Samuel,
    try something like this:
    substring( '00000000'+cast (cast( COUNTRY_CODE, decimal(10)), varchar(10) ),
                         octet_length ( '00000000'+cast (cast( COUNTRY_CODE, decimal(10)), varchar(10) )) - 7,8)

    //Henk

    ------------------------------
    HENK CAZEMIER
    ------------------------------



  • 3.  RE: Formatting Data Column with Pattern

    Posted 12/11/19 06:06 PM
    Thank you for the reply Henk.  I tried your suggestion and played with it a little but could not get it to return values.

    ------------------------------
    Samuel Lane
    ------------------------------