Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is Like/Not Like Formula

Status
Not open for further replies.
Nov 12, 2003
22
GB
I am trying to select the postcode starting with BH1 but do not want for example BH10, BH11 etc. Afetr looking through dummies guides I am using the right expressions but it wont work! Any crystal experts out there? The formula i am using is below:

{CR_CLIENTS.Postcode} like "BH1*" and
{CR_CLIENTS.Postcode} not like ["BH10*","BH11*","BH12*","BH13*","BH14*","BH15*","BH16*","BH17*","BH18*","BH19*"]
 
Hi,
I doubt this formula will work - at least with our CR8.5 it produces an error.
You might try something like:

{CR_CLIENTS.Postcode} like "BH1*" and
not (left({CR_CLIENTS.Postcode},4) in ["BH10","BH11","BH12","BH13","BH14","BH15","BH16","BH17","BH18","BH19"]);

Be aware that the '*' have been removed in the second condition. Also, using '{FIELDNAME} not like' won't work - same as '{FIELDNAME} not in', so you'll have to use:

not ({FIELDNAME} in ...)
or
not ({FIELDNAME} like ...)

Hope that helps,
 
Thanks for the advice, I have tried

{CR_CLIENTS.Postcode} like "BH1*" and
not (left({CR_CLIENTS.Postcode},4) in "BH10","BH11","BH12","BH13","BH14","BH15","BH16","BH17","BH18","BH19");

But it is still complaining about a bracket missing?? I cant see where?

 
Just put square brackets round to look like:{CR_CLIENTS.Postcode} like "BH1*" and
not (left({CR_CLIENTS.Postcode},4) in ["BH10","BH11","BH12","BH13","BH14","BH15","BH16","BH17","BH18","BH19"])

and it works!!!!!

Thank You



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top