Crystal Report XI Issue : Shared Value from Subreport not shown in the right link
I have created Main Report - Outlet Performance to read the cost and Subreport to read the sales
This is the formula in main report :
WhilePrintingRecords;
Shared NumberVar ShareSales;
""
And this is the formula from subreport:
Name of Formula: ShareSales
WhilePrintingRecords;
Shared NumberVar ShareSales;
ShareSales := Sum ({_DemandDtl.BatlD}, {_OUTLET.CPU});
""
I tried to run subreport, it working fine with the sharesales figure, but the moment I add to the main report, the share figure jump to next record (next outlet). It do not follow the link set in the subreport link Outlet-Performance.jpg outlet-performance-report.pdf
Please elaborate further . I am using the same section in the main report @section Ga and hide the detail section. I am using the same section for sub report.
In subreport , the result only shown in Ga Section.
James0628
You accepted my post as the solution. Does that mean that you figured it out?
If not, the idea is that if, for example, you have the subreport in GH1, you would need a second GH1 section. The subreport would be in GH1a and the formula would be in GH1b. Or, another approach would be to put the subreport in the group header, and the formula in the group footer.
If you want to display the subreport data and the main report formula side-by-side, there are ways that you could do that. The best approach may depend on how much data you're displaying in the subreport.
I have another issue to obtain summary total in the main report for the following fields:
1 Demand and Sales (Extracted from sub report)
2. Gp is calculated field (Sales less COST)
Trying to use running total , but is not available. appreciate your help to write in the formula with detail example.
You need to use a variable if you want a total for a variable from a subreport. Using the ShareSales variable as an example, say you had this formula to output the variable in the main report:
What is the variable/formula for TotalSales? I got 0.00 result in sub report.
James0628
TotalSales is a new variable I was creating in the main report. The idea is that each time you run the subreport, you have a formula in the main report add the value from the subreport to the new variable. I wasn't really intending for you to use TotalSales in the subreport. I was just trying to produce a grand total for the end of the main report.
That's not to say that you can't use TotalSales in the subreport. That just wasn't what I had in mind. What were you trying to do with TotalSales? What's in the formulas that use it, and where are they located?
In subreport , the result only shown in Ga Section.