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

Main Report-Sub report question...

Status
Not open for further replies.

fattyfatpants

Programmer
Apr 22, 2004
68
US
CR Version: 9 Developer
Platform: Win XP Pro
Datasources: SQL Server 2000 & SQLBase 7

I am wondering if it is possible to share individual values from a subreport to a main report as opposed to summary values

Sample Data From Time & Billing System (SQL Server 2000)
--Tkinit is timekeeper initials or first initial + lastname
--Tkfirst is first name
--Tklast is last name
--BHours is billable hours
--Hours is number of hours worked
Tkinit Tkfirst Tklast BHours Hours
JMD John Doe 674.50 700.00
psmith Pete Smith 856.25 890.25
mjohnson Mark Johnson 150.75 160.25

Sample Data from the Payroll System (SQLBase 7)
FirstName LastName SSN
John Doe 123456789
Pete Smith 234568790
Mark Johnson 876490653

Sample output
(first & last names from Time & Billing & SSN from Payroll & Billable Hours & Hours from Time & Billing)
John Doe 123456789 674.50 700.00
Pete Smith 234568790 856.25 890.25
Mark Johnson 876490653 150.75 160.25

There is a lot more info coming from the Time & Billing system to be included in the report and I need to grab information for individuals from the payroll system to be included with Time & Billing on the main report...I hope I'm making sense...Thanks in advance
 
Ideally you would link the subreport on the SSN, but you haven't clarified whether there is an SSN field in the time and billing database. Otherwise you can link the subreport to the main report by linking the two last name fields and two first name fields. This will work as long as there are not two people with the same names (and why using an SSN is superior). Then you would place the subreport in the detail section. In the subreport, suppress all sections except the detail section.

You have not indicated that you plan to make any calculations with this data, and if you aren't, then all you need to do is add in the linked subreport to get the display you wish. If you want to then create totals of Bhours or Hours, you would need to set up the individual field in the subreport as a shared variable:

whileprintingrecords;
shared numbervar hours := {table.hours};

You would use this on your subreport instead of the field itself. Then in the main report you would create a formula:

whileprintingrecords;
shared numbervar hours;
numbervar totalhours := totalhours + hours;

You would place this formula in a detail_b section (it must be below the subreport) which can be suppressed using the section expert. Then in the report footer you would add another formula for displaying the results;

whileprintingrecords;
numbervar totalhours;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top