Avatar of daskas27
daskas27
Flag for United States of America asked on

Suppress Section if Field is Null

Hello,
      I have a report that is grouped by Customer, then Engine Program, then Part Number. I would like to suppress everything for the Engine Program and Part Number sections if the Engine Program field is null. In other words I only want to see results if there is a value in the Engine Program field. Can this be done.
I have attached a copy of the report in case it helps.

Thank you
example.rpt
Crystal Reports

Avatar of undefined
Last Comment
daskas27

8/22/2022 - Mon
Mike McCracken

If the engine field is null you won't get  a group for it.  It is automatically suppressed.

mlmcc
Frank Helk

Nontheless CR might react irregular on dbNull values ... and besides of that it ist probably more self-documenting to cast that behaviour into some formula.

In the formatting formula "suppess section" of the two sections you could enter:
IsNull({engine})

Open in new window

That would suppress these sections when "engine" is dbNull without CR freaking out on the value. (the field name might differ in your report ... :)

Furthermore you could insert another section telling "No engine defined" and garnish that with a suppress formula
not IsNull({engine})

Open in new window

to inform the reader about the condition (that behaviour can't be realized with the default outlined by mlmcc ...).
James0628

It's been a while, but, contrary to what mlmcc said, I don't think CR suppresses a group if the field is null (I'm pretty sure I've seen a report with a group for a null field).  I would hate to think that CR would just remove a whole group from the report because the group field was null.

 The "Engine Program" field that you're referring to is tcspnm.pohspec, correct?

 Is pohspec actually null, or is it just blank?  Those are two different things.  In your example report, that field is sometimes blank, but it's never null.

 What do you want to "suppress"?

 If you want to get rid of the entire group, including the details, the simplest thing would be to go into the record selection formula and add

and {tcspnm.pohspec} <> ""

 That's assuming that the field is actually blank, not null.

 If the field actually can be null at times (not just blank), you could add

and not IsNull ({tcspnm.pohspec})


 That will remove any records where pohspec is blank (or null in the second case) from the report completely, so they won't be included in any summaries either.

 For the record, instead of using the record selection formula, you could suppress the desired sections when the field was blank (or null), but then the report would still be reading those records and they would be included in any summaries.

 James
Your help has saved me hundreds of hours of internet surfing.
fblack61
daskas27

ASKER
Ok, what if I did not want to suppress it but have a label like "UnKnown" instead of the blank if the the tcspnm.pohspec field is blank or null ?
ASKER CERTIFIED SOLUTION
Frank Helk

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
daskas27

ASKER
Thanks to all.