COGNOiSe.com - The IBM Cognos Community

IBM Cognos Analytics Platform => Cognos Analytics => Reporting => Topic started by: Newest Guy on 29 Dec 2023 10:16:32 AM

Title: Filter String Based On a Certain Amount of Characters
Post by: Newest Guy on 29 Dec 2023 10:16:32 AM
Hi,

I have a data item that I am trying to filter to only display data if it is more than 5 characters. Most of the data is 5 numbers, but occasionally it will have more than 5 and also include letters too. Is this possible to filter?
Title: Re: Filter String Based On a Certain Amount of Characters
Post by: bus_pass_man on 31 Dec 2023 10:42:03 AM
From what you say, the query item in question would seem to be a text data type as you state that it can have numbers and letters. 

Here's a filter expression which you can use as a guide to what you want to achieve.

char_length({query item} ) > 5



Just as an aside I would recommend you learn a bit about data types as the functions which are relevant to one would not be so for others.
Title: Re: Filter String Based On a Certain Amount of Characters
Post by: Newest Guy on 02 Jan 2024 07:17:50 AM
That worked! Thank you!