COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: kristyparker_concur on 11 Aug 2022 09:29:07 AM

Title: How to determine if string starts with Alpha or Numeric
Post by: kristyparker_concur on 11 Aug 2022 09:29:07 AM
Hello,

I am trying to determine if a string starts with a number. This is what I am trying to say...

CASE WHEN [Level 2] starts with *number* THEN ([Level 3] + [Level 2]) ELSE '' END

I can't figure out how to say 'starts with a number' though...

Any help is appreciated!
Thank you
Title: Re: How to determine if string starts with Alpha or Numeric
Post by: dougp on 11 Aug 2022 11:46:54 AM
You're using + as a string concatenation operator, so I'll assume you are using SQL Server.


case
when isnumeric(substring ([Level 2], 1, 1)) = 1 then [Level 3] + [Level 2]
else ''
end
Title: Re: How to determine if string starts with Alpha or Numeric
Post by: kristyparker_concur on 11 Aug 2022 01:26:48 PM
Yay! That was it.

Thank you so much!
Kristy