Solved

Crystal sub report value on main report

Posted on 2014-01-17
3
6,415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

737 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