Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a value from the subreport to the main report

Status
Not open for further replies.

ccnetwork

Technical User
Feb 5, 2007
12
GB
Hello

I would like to pass two formula's(Period 1 From Date, Period 1 To Date) from the sub report to the main report then use these formulas in a running total to work out how many clients have been registered during the first period of the financial year. I've followed the article at the below url but when I run the report I am getting an error message 'A running total cannot refer to a print time formula'



--------------
Step 1 - Find out period 1 from date:

Create a running total called Period1F in the sub report


Field to summarize: PERIODS.DateFrom

Type of summary: Maximum

Evaluate: Use a formula

{PERIODS.Period}=1



Step 2: Create a shared variable in the sub report:

Create a formula called P1FSub.


WhilePrintingRecords;

Shared DateVar myTotal := Date( {#Period1F})



Step 3: View the shared variable in the main report:


Create a formula called PF1Main


WhilePrintingRecords;

Shared DateVar myTotal;

myTotal



Step 4: Repeat the above process to find out period 1 To date.


Step 4: Create a running total to view all clients registered in April

{Learners.DateStart}>= {@PF1Main} and {Learners.DateStart}<= {@PT1Main}



When I run the report I get the following error message:

A running total cannot refer to a print time formula
Details: @PF1Main

Any advice would be appreciated.

Thanks
 
Running totals execute prior to subreports. There is a wonderful chart in the Help that will give you a lot of insight on when parts of reports get executed, and will help you understand why you get error messages like this. In Crystal Help, go to Search. Then type in "Multi pass". Look for the result named "Multi Pass Reporting Flow Chart". This is such a useful chart that I printed it and have it at arms reach on my desk.
Try rearanging your report to have your "Main" report as the subreport, that way the critical data is passed to a sub and then executed.
Good luck...
 
If the subreport is in the report header, and you just want to count people in the main report who meet your criteria, you can create a manual running total, as in:

whileprintingrecords;
shared datevar fromdate; //your variables renamed here
shared datevar todate;
numbervar cntinrange;

if {table.date} in fromdate to todate then
cntinrange := cntinrange + 1;

Then in the report footer, use a formula like the following to display the result:

whileprintingrecords;
numbervar cntinrange;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top