Solved

Crystal sub report value on main report

Posted on 2014-01-17
3
6,278 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

20 Experts available now in Live!

Get 1:1 Help Now