If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

String code using like operator not working

Started by que1983, 04 Oct 2016 02:14:08 PM

Previous topic - Next topic

que1983

CASE WHEN (refi=1 and (substring([Processing Center],1,2)= 'CD')THEN 1
ELSE 0
END

CASE WHEN ([Refi]=1 and [Processing Center] like 'CD%')THEN 1
ELSE 0
END

I am trying to pull/query records in the Processing Center field that start with CD. Example CD-Richmond, CD-Atlanta.  I tried it with 2 different queries and come up empty.  I have no idea why.  Is there an issue with the logic???

MFGF

Quote from: que1983 on 04 Oct 2016 02:14:08 PM
CASE WHEN (refi=1 and (substring([Processing Center],1,2)= 'CD')THEN 1
ELSE 0
END

CASE WHEN ([Refi]=1 and [Processing Center] like 'CD%')THEN 1
ELSE 0
END

I am trying to pull/query records in the Processing Center field that start with CD. Example CD-Richmond, CD-Atlanta.  I tried it with 2 different queries and come up empty.  I have no idea why.  Is there an issue with the logic???

Hi,

In the first expression you appear to have more open parentheses (3) than close parentheses (2)? That's an obvious syntax issue. Refi would also need to be in square parentheses [refi]

Where are you trying to use these expressions? In a query calculation or in a filter? If the former, are you seeing 1 and 0 values returned?

If the latter, you're taking the wrong approach. A filter should evaluate to true or false, so an appropriate expression would be:

[refi] = 1 and substring([Processing Center],1,2) = 'CD'

Cheers!

MF.
Meep!