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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The keyword 'then' is missing

Status
Not open for further replies.

NonTech01

Technical User
Jan 25, 2010
5
GB
Hi,

I'm having a problem adding supression code against a section in a pre-existing crystal report template. Basically, I want to supress the appearance of some text if one of two conditions are met... here is the code I have so far:

if {Property.Price_Qualification} <> 'PRICE REDUCTION' Or {Property.Price_Qualification} is not NULL then
true
else
false

When running this code, the following error appears:
"The keyword 'then' is missing". I'm not a programmer, so I'm probably missing something obvious out, but any help is greatly appreciated. Hopefully it's self-explanatory what I'm trying to do, and a case of the code not being correct.

Thanks!
 
Try
Code:
not isnull({Property.Price_Qualification})
and
{Property.Price_Qualification} <> 'PRICE REDUCTION'
You used the wrong syntax for IsNull, that caused the error. But it is also pointless having it after the first test, Crystal stops when a test hits a null, even if null is allowed for later.

You don't need to say 'true' or 'false', the formula field will have one of those values, assuming null is tested for. You could also just say @yourtest, which gets the same result as @yourtest=true.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
Hi,

Thanks for your help yesterday. There does still appear to be a problem when running that code though - the 'Price Reduction' image that is controlled by this code will appear - when I run the template - even if the field in question is blank (i.e. null). I would only like that image to appear on the template if the field is displayed 'Price Reduction'. Do you know how I can account for this please?

Thanks.

 

isnull({Property.Price_Qualification}) or
trim({Property.Price_Qualification}) = "" or{Property.Price_Qualification} <> 'PRICE REDUCTION'

I think you described what you wanted incorrectly in your original post. It now sounds like you want the object to suppress if it is blank or null or there is text other than 'price reduction'.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top