COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: FerdH4 on 11 Sep 2024 12:27:17 PM

Title: Is there a filter wildcard value for just a non-numeric single character?
Post by: FerdH4 on 11 Sep 2024 12:27:17 PM
I'm trying to filter rows in a v11.2.3 report to include content based upon just the first character of a string.  However, I know that my data can include any numeric or character value; and, I'm really only interested in filtering to include a single alpha character followed by a dash and then the rest of the string is irrelevant.

I've tried this...

  [Study Error Message] like '_-%'

...but I get rows that include values like "1-" and "2-" as well as "A-" and "B-".

Is there a different wildcard I can use instead of an underscore to exclude the numeric values?

Thank you kindly.
Title: Re: Is there a filter wildcard value for just a non-numeric single character?
Post by: cognostechie on 11 Sep 2024 03:19:04 PM
For the field to have numeric as well as alphabets, the data type has to be char/varchar/string.

Even in a character data type, 1 till 9 is considered lower than A so try:

[Study Error Message] >= 'A-'

If that doesn't work then try:

 substring([Study Error Message],1,1) not in ('1','2','3','4','5','6','7','8','9') and
 substring([Study Error Message],2,1) = '-'
Title: Re: Is there a filter wildcard value for just a non-numeric single character?
Post by: dougp on 12 Sep 2024 03:24:04 PM
What RDBMS?

For SQL Server:
[Study Error Message] like '[a-zA-Z]-%'
For MySQL (and maybe Oracle):
REGEX_LIKE([Study Error Message], "^[a-zA-Z]-.*")