Question

I have set up a main report that has 2 subreports coming into it.
The main report consists of one table : ROOM & two parameters: STARTDATE and ENDDATE. The date range is only in the main report so it can be displayed in the title area. More importantly, it links to the 2 subreports.

Right now, the main report is grouped by Facility and then by Room name. Everything is working great until I try to run it for more than one day. What I want is for the main report to also be grouped by the date, but I don’t know if that is possible as the ROOM table does not contain a date field to link the parameters to so that I could use it in the groupings.

Is it possible to create a Date variable within the subreport that could then be passed back to the main report to be used for grouping? I apologize if this is a dumb question, but I do not work with variables often and shared variables even less than any other.

Was it helpful?

Solution

Short answer: No. You can never group a main report with variables from a subreport. Crystal determines a report's groups early in the evaluation process, before it ever looks at any subreports.

In general, you might want to ask yourself how to avoid the use of subreports in the first place. In my mind the use of a subreport is a last ditch effort when there is simply no other way to accomplish what you want in a single report. In your case, if your main report is only made up of a single table (ROOM), then you would simply need to move the tables from your subreport to the main report, then join them to ROOM. Doing it this way would leave you free to easily group on whatever fields you wanted.

OTHER TIPS

You technically can get those values from the sub-report to the main report.

This blurb describes 'Shared' scope variables.

Shared Variables (Crystal Syntax)

Shared variables use the same memory block to store the value of a variable throughout the main report and all of its subreports. Thus shared variables are even more general than global variables. To use a shared variable, declare it in a formula in the main report as in the following example:

Shared NumberVar x := 1000;

and declare it in a formula in the subreport as in the following example:

Shared NumberVar x;

In order to use shared variables, the variable must be declared and assigned a value before it can be passed between the main report and the subreport.

Shared variables are great for aggregates (sum, etc.) that span the main report and one or more sub-reports.

more info can be found here: http://publib.boulder.ibm.com/infocenter/radhelp/v6r0m1/index.jsp?noscript=1 by searching for 'variable scope'

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