Your proposed solution works, James.
Thanks for your time in providing a detailed explaination of the problem, and its solution!
C. Patrick
Main Topics
Browse All TopicsI've created a Crystal Report to display the sum of labor hours taken from two separate, and disconnected data tables. The report is meant to compare the total labor hours from each of the tables, and identify discrepancies. The report information is grouped first by person, then by payroll date. In a main report, I've created the person and payroll date groupings, and a column which displays the sum of labor hours from one of the mentioned tables in the payroll date group's footer. In a second column, I've inserted a subreport which provides the labor hours summary from the second data table. This report works fine, but I'd like to condition the color of the payroll date field to change when there are discrepancies between the two labor hour column values.
To provide for a conditional check, I've created a shared numeric value in both the main report, and the subreport. In the subreport, I have a formula which sets the shared variable's value to that of the labor hours sum in the same group footer of the labor hours sum. In the payroll date of the main report, I check the shared variable's value to that of the labor hours sum in the main report, to conditionally set the payroll date's font color.
The problem is that the shared variable's value seems to lag behind the actual labor hours sum returned by the subreport, and is present during the conditional check for the following record. I've included a screenshot of the report's result.
Any help in understanding when the shared variable's value is being set would be much appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: James0628Posted on 2009-04-13 at 18:35:01ID: 24134365
The basic problem is that, at best, there is no way to guarantee that a subreport will be executed before a formula in the same section is evaluated. AFAIK, it could go either way, but it's possible that the subreport will always be executed after the formulas are evaluated.
Either way, the answer is the same - Execute the subreport in an earlier section of the main report, before you need the value from the shared variable. If all that you're showing from that subreport is that total value, then simply create a new section above that one (eg. if the subreport is in a group footer, create another group footer section above that one), put the subreport in the new section and use the shared variable where the subreport was.
Don't suppress the new section (with the subreport in it). If you do, the subreport will not be executed. Instead:
Change the subreport so that it produces no output (eg. suppress all of the sections in the subreport).
Go to the subreport format and on the Subreport tab, check the "suppress blank subreport" option.
Go to the Section Expert for the section with the subreport in it and check the "suppress when blank" option.
James