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

Suppress section if field is null

Status
Not open for further replies.

Bloke152

Programmer
Aug 9, 2005
123
NO
Hi all,

I don't understand why this is not working. To me, it should so I must be missing something!

I have a main report with 3 subreports, each in different sections. I want to suppress the sections dependent on the value of a field.
This is working fine, unless that value is null. If the value is null then all sections are shown.
I am using the following suppression formula (as you can see, I have tried to cover all bases!)

({CERT_AN_REP\.COA_FMT} <> "COA_SHET") or (isnull({CERT_AN_REP\.COA_FMT})) or ({CERT_AN_REP\.COA_FMT} = '')

Thanks!
 
Managed to get this working now....
For some reason, I have to check for nulls first. This code works


isnull({CERT_AN_REP\.COA_FMT}) or {CERT_AN_REP\.COA_FMT} = ''
or {CERT_AN_REP\.COA_FMT} <> "COA_SHET"
 
Yes, you always have to check for null first. The reason for this is in the nature of null values - when you compare anything to a null value, the result is null, which is neither true nor false. Since Crystal works from the left of the equation to the right and, with "or" statements, it stops a the first null or true value, and it's looking for true or false (note that this doesn't include null!), you have to do the null check first. This is also the way that most databases work.

-Dell

Senior Manager, Data & Analytics
Protiviti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top