Reputation: 13508
I have a Crystal Report that I populate before displaying to the user using a CrystalReportViewer
.
I have some static text items and line segments that I would like to show and hide programatically depending on conditions in the business logic. Is there a way I can group a bunch of these items together and hide them as a group?
At the moment, my other option is to have two separate reports that are identical except for these superficial differences.
Upvotes: 6
Views: 9542
Reputation: 2111
Do the following steps :
1-Add the required field to the report canvas
2-Right click on the field
3-Select the Format Field menu option
4-On the Common Tab in the Format Editor dialog box, press the Conditional Format button [x+2] button for the Display String option
5-In the Formula Workshop enter the following formula:
if {Tablename.Fieldname}= True then Totext(CurrentFieldValue)
else Totext((CurrentFieldValue)) + " Outstanding"
6-Press the [Save & Close] button
7-Press the OK button of the Format Editor dialog box
Upvotes: 0
Reputation: 32740
By all means, please don't create two separate reports :)
In the Report Design view, you should be able to create sub-sections of your detail section (assuming you're talking about the detail section), right-clicking on the Detail section and selecting "Insert Section Below".
You should now have "Details a" and "Details b" sections. You can put your text in the "Details b" section, and apply a conditional suppression formula to it.
To conditionally suppress the "Details b" section, right-click on it in the Design View, select "Format section...", click on the button next to the "Suppress" checkbox, and add your formula there.
Upvotes: 5