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

Group Selection

Status
Not open for further replies.

ulicki

Technical User
Oct 24, 2001
88
US
Hi,

Crystal report version 7.0

I am creating a report that will be distributed to employees. Not all employees in the database will have the data criteria and thus not show up on the report. The report will pull one set of data for the employee in the main report and one set of data in a subreport. The employee can have data records in only the main report, only the subreport, both main and subreport, or in neither. In this last case the employee does not come on the report.

My concern is that if the employee has neither he does not show up on the report at all (i.e. no header information). So I am thinking of using a group selection. If the employee has records in the main report the group selection formula is easy, but if they only have records in the subreport I have concerns. I can bring back a shared variable from the subreport to indicate if there were data records or not (probably initialize a shared boolean variable to false and change to true if I find a record). OK now I can bring this shared variable into my group selection formula, but this variable is not evaluated until the records are printing.

So my question is does the group selection evaluate while the records are printing, or if I use WhilePrintingRecords in the group selection formula can I force it to evaluate at this time?

I just want some advice before I do trial and error.

Also if there is another way to accomplish this that would be great.

Thanks,

Mike
 
Group Selection can't add records if they aren't in the report.

I would create a different main report, one that reads only the master table of all employees. Then make the other reports into subreports in that. That way you will always have a heading regardless of which table the person is in. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Hi Ken,

I dont' think I asked my question correctly. Let say each employee can have two types of bonuses throughout the year called A and B. However in the database these types cannot be pulled by a single query (I want to avoid creating a view that unions the information). Now I need a subreport to get the Bonus B type information. I think you are suggesting writing a subreport to get both Bonus A and Bonus B information.

My requirement is that if the employee does not recieve any bonuses they do not show up on the report. I do not want a heading if the employee recieves no bonuses. However if the employee receives any bonus he will appear on the report.

Thanks,
 
Since either report could be missing employees, you will have a problem trying to link the subreport to the employee. When an employee is missing in the main report, it can't launch a subreport for that employee.

You could run the subreport at the end of the report (unlinked) which would include all employees, but the lists would be separate and employes who have both bonuses would not have their bonuses together.

Group selection can't help here. It can only evaluate the subtotals in one report. It happens before the subreports are run. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Hi Ken,

Thanks for your help. I was planning on Left Outer Joining my employees to Bonus A so I would always get an employee record in the main report so I could pass it to the Bonus B subreport. But because the group selection happens before subreports I am out of luck for group selection.

Thanks again,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top