I need the details section to suppress if a custom date field is blank in Crystal Reports

8k views Asked by At

I have the following suppression formula in the details section:

{JCJM.udRough} <= #1/1/2013 12:00# AND {JCJM.udTrim} <= #1/1/2013 12:00#

and it works. However, I also need it to suppress if the udRough or udTrim field is blank. When I try to add

OR {JCJM.udRough}=""

it says that a date-time is expected where the blank quotes are. Can someone please help?

2

There are 2 answers

0
Ryan On BEST ANSWER

As a general rule in CR, if a field can be null then you should explicitly check for that case first in a formula, otherwise it will not evaluate properly. Otherwise, CR will treat it like an unhandled exception.

So in your case, CR is short-circuit evaluating the expression {JCJM.udRough}<=#1/1/2013 12:00# as the very first thing, sees that the field is null, and stops evaluating the rest of the formula since it has encountered an exception.

What you need is:

(isnull({JCJM.udRough}) or {JCJM.udRough} <= #1/1/2013 12:00#) and (isnull({JCJM.udTrim}) or {JCJM.udTrim} <= #1/1/2013 12:00#)

0
Siva On

Try

if ISNULL({JCJM.udRough})
Then true
else false

This is from my understanding from your question if you are searching for something different let me know will try to answer it.