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

Can a Main Report Section grow based on the size of a Sub Report

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
0
0
US
I'm using Crystal Reports 2011 and what I would like to do is have the Main Report footer section grow based on the size of the Sub Report.

Here is the layout of the report:
Code:
 GF1a has a Sub Report for employee's job punches (could be from 1 to 4 jobs)
GF1b has a passed variable {@PassJobNumber} this comes from the Sub Report
GF1c has The employee's First and Last Name
GF1d has a line to seperate the records
Sections 1a and 1b have the underlay checked

When there is only one record in the Sub Report everything is displayed in one line. However, when there is more than one record in the Sub Report then the resultes run into the line in GF1d. I can stop this by increasing the size of GF1c. Unfortunately it leaves a large white space for all of the Employee's who only have one record. I was wondering if there is some way to have the Main Report adjust for those employees who have more than one record from the Sub Report.

Thanks for your help!
 
You don't want to use underlay on a section that has a variable height. Remove the underlay from 1a and fine tune it from there.
 
Thanks for your reply!
I've done that already but when you have an employee with one Job punch it doesn't display in one line.
What I'm trying now is to create a formula that counts the number of Job punches and pass that value to the Main Report. Which works fine! Now I'm trying to write a formula the Underlay whhich looks at the passed Job Count and if it's greater than 1 then don't underlay. So far it's not working but I'll keep trying.
 
I have this working with one minor problem. When I pass the Job Count value from the subreport to the mainreport the values are off by one record. I've had this problem in the past and corrected it by placing the formulas in the correct section. I believe I have the formulas in the right sections but the passed value is still off by one record. I'll explain the structure below.
Code:
The mainreport has 1 table Employee and one group Employee
Everything is in the Group footer
GF1a has a Sub Report for employee's job punches 
GF1b has a passed variable {@PassJobCount} this comes from the Sub Report
GF1c has The employee's First and Last Name
GF1d has a line to seperate the records


The subreport has 3 tables
Job
Job_Operation
Transaction_Data
Transaction_Detail

The detail section has the following fields
Job.Job
Job_Operation.Op
Transaction_Detail.Start
{#JobCount) a running total formula on the Job.Job field set to count (eval each record and reset at change of group)

The Group Footer has one formula
{@PassJobCount}
whileprintingrecords;
shared numbervar jobcount := ({#JobCount})

The Pass formula in the Mainreport as listed above is in GF1b
(this is the formula)
whileprintingrecords;
shared numbervar jobcount;
Any ideas would be greatly appreciated!!
Thanks for the help
 
Formulas in a section are evaluated before subreports in that same section. So I don't see a way to control the underlay of the section that contains the subreport using a value coming from that subreport. In some cases I have actually had to run the subreport twice, once invisibly ahead of the other, and use that to control the visible section.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top