Solved

Crystal sub report value on main report

Posted on 2014-01-17
3
6,232 Views
Last Modified: 2014-01-21
I want to place a sub report value in a different section of the main report, does anyone know how?
0
Comment
Question by:HKFuey
3 Comments
 
LVL 22

Assisted Solution

by:Ido Millet
Ido Millet earned 150 total points
ID: 39788284
As long as the target section is below the section where the subreport is, you can declare and set the value of a shared variable in the subreport.  Then, in a main report formula, declare the same shared variable.  Google "Crystal shared variables" for examples.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 350 total points
ID: 39788545
Ido is correct.  The biggest mistake report developers make with shared variables is they try to use the shared variables in sections before the subreport.

Crystal evaluates sections from the top down and subreports are the last objects evaluated in a section so the values from the subreport cannot be used until the section after the subreport.

Basic method I use
In the main report
Add a formula to the report header
WhilePrintingRecords;
Shared NumberVar mySharedNumber;
""

Open in new window


In the subreport add a formula
WhilePrintingRecords;
Shared NumberVar mySharedNumber;
mySharedNumber := Formula for the value;
""

Open in new window


In a section after the subreport to display the value
WhilePrintingRecords;
Shared NumberVar mySharedNumber;
mySharedNumber 

Open in new window


The WhilePrintingRecords line is not required.  Using Shared variables forces the evaluation to be in the printing pass.  However, I use it as a way to document when the formula is evaluated.

mlmcc
0
 

Author Closing Comment

by:HKFuey
ID: 39796813
Thanks for the help, these instructions are much clearer than the ones I Googled!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now