Print Page | Close Window

Image Suppression and Null Handling

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17844
Printed Date: 28 Apr 2024 at 10:07am


Topic: Image Suppression and Null Handling
Posted By: coffeedrinker22
Subject: Image Suppression and Null Handling
Date Posted: 25 Oct 2012 at 10:08am
Alright so I have a report where I'm doing conditional image suppression based on a field in one of my tables. We'll call the images 'T' and 'L'. They are also the values in the field.

I want image T suppressed when my field is equal to L. I want image L suppressed when my field is equal to T or my field is null (so essentially unless my field is equal to L, display T). I have it set up so they work oppositely right now.

On image T, the conditional formula looks like this:
field="L"

On image L, the conditional formula looks like this:
field<>"T"

When I try to add in an exception to take care of the null scenario, it breaks. I've tried adding field<>'NULL' to the T conditional and isnull(field) to the L conditional and neither work.

Any help? Thanks.



Replies:
Posted By: comatt1
Date Posted: 25 Oct 2012 at 10:32am
see if u can make it work within options in toolbar -> report-> reading data - > uncheck convert database null values to default and convert other null values to default. Default probably is = '' not null.

or evaluate len of field, crystal can make data empty as opposed to null, try if len(field)=0 as opposed to null


Posted By: coffeedrinker22
Date Posted: 25 Oct 2012 at 10:47am
Convert null values was already unchecked, and I tried evaluating the length of the field and neither worked (although both were great ideas). =/

I should also mention that there are other options for the values in the field (A, B and C) but those should all display the 'T' image. When the field value is one of these other options, it displays no image either, so it's not just the null exception that's throwing it off.


Posted By: coffeedrinker22
Date Posted: 26 Oct 2012 at 3:22am
Ended up having to just take out the nulls in SQL using isnull(). thanks for the response!


Posted By: hilfy
Date Posted: 26 Oct 2012 at 4:55am
Your other option would have been to set up your formula to explicitly check for null, something like this:
 
IsNull({field}) or {field} <> 'T'
 
Nulls require special handling when doing comparisons - anything compared to Null is Null.  So, for example, your {field} <> 'T' does NOT return false when {field} is null, it returns {null}.  That's why you have to explicitly test for null and you need to do that check BEFORE you check for a value or it won't work correctly.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: coffeedrinker22
Date Posted: 26 Oct 2012 at 4:59am
ahhh, that's definitely what my problem was, I was checking for null after my other criteria. thanks!!



Print Page | Close Window