?
Solved

Data from sub-report to main report

Posted on 2009-04-29
4
Medium Priority
?
472 Views
Last Modified: 2012-08-14
I have a Crystal Report in which has 1 sub report. I have the formulas on both the sub-report and the main report to bring in the data from the sub. I believe I have them in the proper order on my report so Crystal evaluates the formula properly. My issue is, the formula returns the proper value from the sub report but then that value is repeated on the main report until a new value is found on the sub while it should just be zero.

Formula on sub:
//@SubFormula
//Stores the grand total of the Sum {@MtypeTotalCost} field
//in a currency variable called 'myTotal'
WhilePrintingRecords;
Shared NumberVar myTotal := Sum ({ContainerInv.Qty}, {ContainerInv.Product})

Formula on Main:
//@MainFormula
//Returns the value that was stored in the shared currency variable called
//myTotal in the subreport
WhilePrintingRecords;
Shared NumberVar myTotal

                   
0
Comment
Question by:jpdnorthern
  • 3
4 Comments
 

Author Comment

by:jpdnorthern
ID: 24263594
Here is a snapshot from the report.

subreport.jpg
0
 

Author Comment

by:jpdnorthern
ID: 24263642
Here is the layout design of the report.

subreport2.jpg
0
 
LVL 7

Accepted Solution

by:
PCIRichard earned 2000 total points
ID: 24264007
You probably need a formula in the report header section of the subreport that sets myTotal to Zero

e.g.
Shared NumberVar myTotal := 0

this should reset the value each time the subreport is reached
0
 

Author Comment

by:jpdnorthern
ID: 24264046
PCIRichard, Brilliant! Thanks a ton. This has been frustrating me for some time.

Jason
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

850 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