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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RETURN A VALUE FROM A SUB-REPORT

Status
Not open for further replies.

kettie

Technical User
Sep 18, 2002
24
0
0
AU
Crystal Reports V9
SQL database

I have developed a main report which forecasts leave balances by employee at a future date, and then linked a sub-report which details any future leave events recorded for that particular employee.

What I'm trying to do is to deduct the total leave hours booked (which are on the sub-report) from the leave balance (which is on the main report).

I'm trying to construct a shared variable to pass the booked leave hours in the sub-report to the main report and have tried to follow advice previously given to others in this forum. However, I'm really struggling.

By placing the following formula in the Group Footer on the sub-report, I'm able to get the correct value of the future leave to show on the sub-report

whileprintingrecords;
shared numbervar FutureLeave := sum({EMLVE.LVE_HOUR_TKNN});

In my main report, I have placed the following formula in the group header :

whileprintingrecords;
shared numbervar FutureLeave :=0;

In the main report in the group footer, I've placed the following formula:

whileprintingrecords;
shared numbervar FutureLeave;

The main report is bringing back a value, but it's dropping the value against the employee on the next line (i.e if Employee A has 24 hours of future leave, the 24 hours is showing against Employee B)

Can someone please point me in the right direction?

Thanks

 
If a formula is in the same section as the subreport, it will fire BEFORE the subreport, picking up the last subreport's value. Split the section so the formula can be in a section just AFTER the one holding the subreport.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Tips and Tricks / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top