COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: stanleytheyak on 19 Dec 2013 11:35:12 AM

Title: Filter on words with apostrophes
Post by: stanleytheyak on 19 Dec 2013 11:35:12 AM
I can't seem to find an answer on this anywhere.  I'm doing a filter that says [Activities].[Notes] contains 'didn't' (along with some other keywords).  Usually, if I were to filter on a word like "didn't", I would enter 'didn''t' and that would work.  What Cognos seems to be doing is returning anything that has 'didn' and 't' instead of 'didn't'.  What is the key to including words with apostrophes in Cognos?

Any help here would be GREATLY appreciated.
Title: Re: Filter on words with apostrophes
Post by: MFGF on 19 Dec 2013 11:43:20 AM
Hi,

This might seem counter-intuitive, but have you tried using four single quotes (ie '''')

This is a single quote in single quotes with a single quote preceding it to act as an escape character...

I haven't tried it but it would be quick for you to test.

If it doesn't work, you will inderstand why everyone refers to me as the Cognos muppet :)

MF.
Title: Re: Filter on words with apostrophes
Post by: stanleytheyak on 19 Dec 2013 11:51:21 AM
I've tried it as [Activities].[Notes]contains 'Didn''''t' and it returns nothing (I know there are notes that contain "didn't" because I put them there).

I've also tried it as [Activities].[Notes].[Comments]contains 'Didn'''''t', thinking I'd need the fifth ' to include the t at the end.  I get this error:

QE-DEF-0459 CCLException
QE-DEF-0260 Parsing error before or near position 52 of: [Activities].[Notes].[Comments]contains 'Didn'''''t'
QE-DEF-0261 QFWP - Parsing text: [Activities].[Notes].[Comments]contains 'Didn'''''t'
Title: Re: Filter on words with apostrophes
Post by: Lynn on 19 Dec 2013 01:46:15 PM
You already have single quotes surrounding the string, so you should just need two single quotes within. One to represent the quote you are searching for and one preceding it as an escape character.

Try this:

[Activities].[Notes].[Comments]contains 'Didn''t'
Title: Re: Filter on words with apostrophes
Post by: CogFanGal on 14 Sep 2016 01:36:06 PM
Thanks Lynn!  Works great.