Business Automation and Software Blog

Business Reporting Tips and Tricks - Using Crystal Reports

Posted by Nicole Sherman on Wed, Dec 14, 2011 @ 05:43 PM

Suppress Crystal Subreports without losing hidden Shared Variables

Up until two hours ago, using Crystal Reports was giving me fits! I had a subreport that contained a shared variable which was filling my report with blank rows which I could not hide without messing up the data in the main report. It looked terrible with all the extra blank spaces in it, but I needed the subreport with the shared variable to make it all work.

I seriously dislike shared variables in subreports!

Admittedly I have a love-hate relationship with shared variables and subreports.  However, I am learning to work around them and found a new trick that is a huge life saver.

To give some background: In using Crystal Reports for business reporting, when you pass a variable from a subreport up to the main report, the subreport must remain available to pass the data.  Normally this results in blank sections that take up space in the report and may create awkward, uneven blank areas.  Suppressing the sections conditionally may not always be an option, especially when the condition depends on the data coming in on the shared variable.  Meaning, I have to use the value from the variable to calculate if it should be suppressed in the main report but once I suppress it, I lose the variable for the calculation and so the rule gets broken. It's the chicken and the egg all over again.

The image below illustrates my hidden subreport that is passing a variable into the main report. The variable is used to provide the Committment which affects whether the item is Below Minimum. When the user selects to suppress items that are not below minimum it affects the spacing in the crystal report as seen below.  The blank rows are from the subreport above each suppressed above minimum item row.

business reporting crystal reports image 1


Now for the new business tip and trick: There is a workaround that will eliminate the blank spaces left behind by that subreport.  In order to suppress the hidden subreport there are several steps to take. I have put together printscreens to help you as we go along.


1. Go into the subreport, and hide all sections of the report using the Section Expert. Suppression will prevent the data from being available to pass into the main report.

business reporting crystal reports image 2


2. Go to the main report, right click over the section that contains your subreport. Note: the subreport needs to be in a section that does not contain anything else.

business reporting crystal reports image 3


3. Using the Section Expert, set the section to suppress all blank sections by checking the appropriate box as shown below.

business reporting crystal reports image 3


4. Go to the Subreport field in the main report and right click over it, and select Format Subreport.

business reporting crystal reports image 5


5. Go to the Subreport Tab, and check the Suppress Blank Subreport checkbox.

business reporting crystal reports image 6


6. Once you complete all the steps, your report should hide the subreport that is passing the parameter without losing the data being passed.  The result on the example report is shown below.  Always make sure to tie out the values of the data in the report, as changes to subreports with variables that are used in calculations can cause adverse effects if done improperly.

 business reporting crystal reports image 7

Voila - a beautiful report, and my numbers all tied out when I compared them to the report that did not have the suppression/hide set up in it. 

Should you need additional assistance with business reporting using Crystal Reports, please contact us for a complimentary reporting consultation today!

Contact PositiveVision ► ► for a Complimentary  Reporting Consultation

Topics: Business Reporting, crystal reports