Question

tl;dr: is it possible to have grouping levels within a subreport which gets its data entirely from the main report? I need to produce a single report which takes a single set of data and displays four or more different summarizations/calculations on the data.

=================================================================================

It would be easy enough to make a separate stored procedure call in each subreport. But since a lot of the data will be common to all of the subreports, I'd like to avoid the performance cost of getting the same data from SQL Server repeatedly.

I'd like to get all the raw data once, from a single stored procedure, and link that data to the various subreports within the single .RPT file. So far it seems that I cannot use the Group Expert in a subreport that does not call a stored procedure -- there are no Report Fields displayed to select for grouping.

The subreports could be described as cost summaries, calculated as follows: A summary for all months, A breakdown of just the current month, calculated averages per person/month, and multiple cost breakdowns by plan for the current month.

For the first subreport, I can get the desired data as parameters, by linking desired fields and parameters from the main report. I would need to group this to group this data by the month of a particular date column, with one row per month and a grand total at the end. But if I click on the Group Expert in that subreport, there are no Report Fields available for me to group by.

Since all of the calculations involve a single set of data, I'd like to just get that set from a single stored proc call, and have Crystal perform the various calculations.

Can this be done in Crystal Reports XI, with or without subreports, without having multiple calls to the database that return the same data more than once?

Was it helpful?

Solution

Ultimately I gave up on the original request. Here what I implemented as Plan B instead.

I created a new table in SQL Server to hold all of the detail-level data needed for this report. The main stored procedure associated with the report 1) deletes old data from the table based on the given parameters, 2) inserts all of the necessary data, and 3) returns just the data needed for the first and outermost summary report.

I have Crystal using Group Headers and Footers, combined with summaries and running totals, to calculate the totals I want two different ways. Then I've added two subreports for the more complex grouping, summarizing, and filtering I want to do.

Each of those subreports calls its own stored procedure, which queries the new table I've created for just the necessary data columns for that particular subreport. Again, I use Group Headers and Footers and suppress the Detail section to get the summaries by group that I want in each of the subreports.

It's not as elegant a solution as I originally had in mind, but ultimately it meets our needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top