Talk with the Author
 Crystal Reports Forum : General Information : Talk with the Author
Message Icon Topic: Empty subreport still showing Post Reply Post New Topic
Author Message
mist83
Newbie
Newbie


Joined: 20 Sep 2008
Online Status: Offline
Posts: 4
Quote mist83 Replybullet Topic: Empty subreport still showing
    Posted: 07 Jun 2009 at 8:57am
In regards to Chapter 12 of Crystal Reports .NET Programming (ISBN 0-9749536-5-2 pages 225-228), specifically regarding a method to prevent empty subreports  from displaying:

The text suggests a method to hide subreports that have no data: include the subreport twice, with a variable from the first subreport being used as a flag for whether or not to display the second subreport.

Using this method, you end up including the subreport twice, with the first one always being hidden, and the second one only being conditionally hidden.
 - At best you have passed extra data in to into CR (headers and the like), and even though it's not displayed the CR engine still has to handle this extra data.
 - At worst, you have potentially duplicated several (dozens, if not more) of rows of data that the CR engine has to deal with - again, even if it's not displayed, the engine still has to take time to deal with this data.

The method proposed points out that because a subreport is considered an object, it is always included on the main report in a way that causes "SuppressIfBlank" has no effect. This appears to be because of the fact that the headers are always shown on a subreport. If you create a subreport with only data - and no headers - you will see that the if "SuppressIfBlank" is set on the section that contains that subreport, the main report prints as expected (with the subreport suppressed when there is no data, but present when there is data).

This led me to thinking that I could put the conditional "display flag" in the subreport itself - but instead of having two subreports and conditionally displaying the second subreport, I could conditionally display the header section of the subreport depending on whether the subreport had data. A quick test verified my assumptions, and I can print the report with the subreport displaying as I expected it to display.

Am I overlooking something here? My method appears to work each time, and I think I've tested every possible combination (subreports with / without data). However, because I am using CR to automating production of reports for a 3rd party, I can't always be there to eyeball the results. Can I safely assume that what I've implemented will continue to work?

Thank you,
Mick

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.