Shared Variables from a “suppressed” subreport

Wednesday 17 December 2008 @ 12:31 pm

A few years back I wrote about the Stealth Subreport. This is a subreport that doesn’t appear on the report but does run in the backround, providing shared variables to the main report. One of the limitations I listed at the time was the need to have a visible section that occurs at the same frequency as the subreport so that it can be hidden ‘behind’ something. In other words you couldn’t have a suppressed subreport at the detail level but have it still run and generate shared variables for use in the Group Footer or Report footer.

But I just learned that this limitation goes away with v9 of Crystal Reports. For versions 9 and later there is a method that allows you to truly have a suppressed subreport that is run invisibly in the background. It stems from a new feature introduced with version 9 called “Suppress blank Subreport”. Normally this used in combination with “Suppress blank Section” to hide a subreport that doesn’t find any data

What I didn’t realize till this month is that “blank” can also mean a subreport that has all of its sections hidden or suppressed. So even if there is data, as long as there is no visible output the subreport is considered blank and will be suppressed. I also didn’t realize that using these properties to suppress the subreport does not prevent the subreport from running. Normally suppressing a subreport means that it won’t run. But apparently these blank subreports are run before Crystal determines that they are blank, so there is time to actually store and capture their shared variables.

Thanks to Phyllis Swenson of CFI who pointed this method out to me.









Leave a Reply

Jeff-Net
Recrystallize Pro

Crystal Reports Server