Print Page | Close Window

Suppressing TextBox based on Data Fields

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19294
Printed Date: 02 May 2024 at 4:33pm


Topic: Suppressing TextBox based on Data Fields
Posted By: Mike Hoyt
Subject: Suppressing TextBox based on Data Fields
Date Posted: 19 Mar 2013 at 8:30am
I have a DataField and an associated TextBox Object with name of "Label" which serves as a label for the DataField.  When the DataField's value is NULL, that field is automatically suppressed on the report.  What I want to do is set up a conditional format on the TextBox so it will also be suppressed if the DataField is NULL.

I've gone into the TextBox Formats and selected the Formula Editor next to Suppress.  I enter the following

IsNull {DataField}

But this has no effect on the TextBox.  I also tried

If IsNull{DataField}
Then {Label}

but I get the error that {Label} is not a field.  Which is true, it's an object.

How do I suppress an object based on some other field being NULL?



Replies:
Posted By: DBlank
Date Posted: 19 Mar 2013 at 8:39am
are you referencing labels that are inserted in page or group headers when you insert a field into the detail section?


Posted By: Mike Hoyt
Date Posted: 19 Mar 2013 at 8:45am
Both the DataField and TextBox are in the Detail section.

It might help to understand my Data Source. I'm building a Report Card. The report Card for every student must contain the exact same set of fields, but because not every student gets graded on every item I can't do something simple like

Student Subject Grade

and let CR just fill in as many rows as required for each student.

Instead, my data source has every possible field ofr every student.  And my report design is then a matter of placing the fields in the Detail section so I get the layout desired.  But no grouping, no footers, etc.  Very basic CR layout as all the work is really being done in the data source


Posted By: Mike Hoyt
Date Posted: 19 Mar 2013 at 8:46am
Oh, sorry, misunderstood your question.  I deleted the label that CR automatically generated when I dropped the DataField in the Detail Section. I subsituted my TextBox.  Should I have just kept the automatic label?


Posted By: Mike Hoyt
Date Posted: 19 Mar 2013 at 8:54am
OK, tried using the label that comes with the DataField.  And setting the Suppresson formula to

IsNull ( {DataField})

and that does it!  Thanks for the hint


Posted By: DBlank
Date Posted: 19 Mar 2013 at 9:09am
glad you got it Thumbs%20Up



Print Page | Close Window