IBM Business Analytics

 View Only
  • 1.  Have To Start Somewhere! Testing A String To Determine If Numeric

    Posted Mon January 16, 2023 12:38 PM
    Hello all,

    Very noob-sauce IBM Cognos report developer (< 30 day) here just trying to learn some of the basics. 

    My task today is to determine if a string data type field contains all numeric data as a criteria for including/excluding a row with that data element in the report.  Looking thru the functions available to me in 11.1 I do not see anything like an isNumeric or really anything like that.  Would love some advice.  Thank you!

    Please let me know if I should direct these questions to other forums / other sites.  Thank you all for any assistance, guidance!

    ------------------------------
    Anthony Wilson
    ------------------------------


  • 2.  RE: Have To Start Somewhere! Testing A String To Determine If Numeric

    Posted Tue January 17, 2023 07:31 AM
    Edited by NIGEL CAMPBELL Wed January 18, 2023 07:03 AM

    You may get solutions from others, that depend on using a function that a database vendor supports. Be that an 'IsNumeric' type of function or a data type conversion function which can return a specific value when a conversion would fail.

    There isn't a generic built in function in CA at this time, but you can use the built in regex capability.

    For example, where a definition of a number might be is optional leading sign, followed by one or more digits.

    case when occurrences_regex (   '[+-]?[0-9]+\b'  , [REGEX].[CASE].[C1]  ) > 0 then 'looks like a number'    else  'has some non-numeric stuff in it' end



    ------------------------------
    NIGEL CAMPBELL
    ------------------------------



  • 3.  RE: Have To Start Somewhere! Testing A String To Determine If Numeric

    Posted Thu January 19, 2023 09:07 AM
    Hi Anthony,

    There is a community called "Cognos Analytics with Watson", you should direct your next questions to this URL:
    https://community.ibm.com/community/user/businessanalytics/communities/community-home?CommunityKey=6b10df83-0b3c-4f92-8b1f-1fd80d0e7e58

    Best regards,

    ------------------------------
    Patrick Neveu
    Positive Thinking Company
    ------------------------------