Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing dataset between parent report and sub-reports in Crystal reports 2008?

I'm fairly new to Crystal reports and use Crystal Reports 2008 for our reporting needs.

We've a requirement where data from a single source needs to be presented in the report in 3 different ways.

So, the way I designed it, to have 3 different sub-reports with data source set to the same procedure from the DB and a container report which holds these sub reports. Based on the user selection to view the report individually or grouped I suppress/not suppress the sub reports in the container report.

The reports works perfectly as per the requirement with the current design. But I'm troubled by the performance of the report when the user selects to see all the 3 presentation modes together i.e. when all the 3 sub-reports are called. The obvious reason is the same data fetched from the DB by the sub-reports individually instead of a one time fetch and reuse across the sub-reports. I thought there should be a way the dataset from a source can be shared between the sub-reports without need to hitting the db again. But I'm yet to find a way to do that in Crystal Reports. Is there a way we can implement this obviously for performance benefit?

Notes:

1) I chose the design of 3 separate sub-reports to present the same data because the requirement wants it modular. But I'm aware, it's usually not recommended to use sub-reports when the data used is same.

2) The presentation of data in each sub report is fairly complex. Each sub report uses at least 4 to 5 group sections and they're not the same across the sub reports. So basically I don't know of a way to implement the different presentations with multiple group sections in a single report without using sub-reports to work around this performance problem.

3) I've pretty much optimized everything in the DB procedure and it's not the pain point.

I was looking around using Google and I assume from what I understood, I'm looking for a functionality like Data regions from SSRS in Crystal Reports. I may be wrong with this as I don't know SSRS and didn't understood Data regions from what I read.

So to summarize, does Crystal Reports support a functionality which I imagine like say, fetch the data from the DB in the main container report and pass/use it across the sub-reports without hitting the DB again?

like image 678
lakshminb7 Avatar asked Nov 04 '22 11:11

lakshminb7


1 Answers

Subreports bind to the datasource just like the main report. Data from the main report are usually passed as parameters. As far as I am aware no data caching occurs in the binding process. If you're presenting the reports through a custom report viewer you can bind the datasource for the subreports with the same datasource as the main report and save yourself the extra round trip(s) to the server. Otherwise, based on your description it may be possible for you to creatively use conditional formatting to hide/show group sections if the data for the main and subreports are from the same stored procedure.

like image 52
Justin Avatar answered Dec 07 '22 12:12

Justin