Crystal Reports - 3 New Uses For Sub Reports

I hate sub reports and always consider them the lastinformation you want into one or more arrays and
resort in any reporting solution. The negative effect onpass them through to the sub report to format and
performance and maintainability is just not worth thegroup as you want.
easy ride they give the report writer. Nine times out ofIt is possible to display the array in the main report and
ten reporting requirements can be met using a littleforgo the need for a sub report at all, but if you are
forethought and planning (and a solid understanding ofreporting against a lot of data there is a chance the
formulas).report will finish before the array has been fully
That said, there are a few novel ways of using subdisplayed.
reports which will not affect performance and actually3. Conditional Data Targets
prove a boon to the developer.I come across this issue quite often: a report is needed
1. Report Headerwhich always shows the same set of data, plus one
Any information, graphics, logos or special fields (Dateof two (or more) other sets of data depending on the
report was run etc) which will appear in every reportuser's choice or the results returned from the first set
can be built into a sub report which is then added toof data.
the main report.Because a single report can only have one set of
The performance hit is minimal, and a small amount islinked tables, multiple sub reports must be used.
shaved off the development time, plus, it can go a longFor example: a sales report shows revenue for a
way to standardising your reports. But the real benefitparticular office, if the office has met its target the
comes when the business decides to update its logomanagers want to see how they compare to the rest
or corporate color etc. As long as the sub report is setof the other offices, but if they fail to meet their target
to "Re-import When Opening" (via the sub report'sthey want to see the sales broken down by each rep
Format Editor), only one sub report needs to beto identify any problem areas.
changed to impact across the entire report library.A report based on sales reps and one based on
2. Reconciling Conflicting Groupsnation office sales require completely different tables.
Often there is a requirement to show the sameThe most efficient way to solve this problem is to
information summarised by logically conflicting groups.create a sub report for each. Whichever is not needed
For example: showing the total sales for each weekis suppressed and given Record Selection criteria
within a month and totals sales per team in a month.which will return an empty report. The required sub
A typical sub report can be used to load the datareport runs as normal.
again then group it by the second value, and this is theSummary
typical way to use a sub report. But accessing theSub reports can kill a report's performance, but when
database again for data you have is a waste ofused with a little imagination they can be a helpful tool
resources which can be crippling with bigger reports.in expanding Crystal Reports functionality in a way that
The most efficient way to handle this is to load thecannot be realised by any other method.