COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: Todd129 on 19 Dec 2012 11:31:29 AM

Title: Help simplify long "not like" filter statemet with wildcards
Post by: Todd129 on 19 Dec 2012 11:31:29 AM
Hi all --

I am trying to simplify a long, inelegant "not like" filter with wildcards (below). I have not been able to condense the statement without errors. Many thanks for sharing your expertise on this board.  -- THE NOOB

[DOC_CONTROL_ANALYST_NAME] not like 'CBL%' AND[DOC_CONTROL_ANALYST_NAME] not like 'SYBR%' AND[DOC_CONTROL_ANALYST_NAME] not like 'OXALIC%' AND[DOC_CONTROL_ANALYST_NAME] not like 'TRIZMA%' AND[DOC_CONTROL_ANALYST_NAME] not like 'QS12K%' AND[DOC_CONTROL_ANALYST_NAME] not like 'STPR%' AND
[DOC_CONTROL_ANALYST_NAME] not like '(G5%'  AND
[DOC_CONTROL_ANALYST_NAME] not like 'RNase%' AND
[DOC_CONTROL_ANALYST_NAME] not like 'BLANK%'  AND
[DOC_CONTROL_ANALYST_NAME] not like 'REL ATTUNE%' AND
[DOC_CONTROL_ANALYST_NAME] not like 'Part 2%' AND
[DOC_CONTROL_ANALYST_NAME] not like 'RELEASE BOMS%' AND
[DOC_CONTROL_ANALYST_NAME] not like 'Release new RMs%'
Title: Re: Help simplify long "not like" filter statemet with wildcards
Post by: blom0344 on 20 Dec 2012 04:57:40 AM
What is the error message?

delete [DOC_CONTROL_ANALYST_NAME] not like '(G5%'  AND
from the expression

What happens?
Title: Re: Help simplify long "not like" filter statemet with wildcards
Post by: Todd129 on 20 Dec 2012 10:05:21 PM
Hi there --

The above expression works fine. But I would have liked to write it a  form like [Data Item] not like ('A%', 'B%', 'C%') or something similar instead of using all of those AND statements.

When I try this approach I get the error:

QE-DEF 49 CCLException
QE-DEF-0260 Parsing error before or near position: 31 of: [APPROVED_BY] NOT LIKE ('A%' , 'B%')
QE-DEF-0261 QFWP - Parsing text: [APPROVED_BY] NOT LIKE ('A%' , 'B%')

Title: Re: Help simplify long "not like" filter statemet with wildcards
Post by: blom0344 on 21 Dec 2012 02:13:41 AM
like and not like do not accept an array, only single values.  Perhaps yhou could use the substring function to some extend to cluster values that have the same length