azizi jaafar
asked on
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
James
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.
James
ASKER
Thanks, Got it
OK. Just wanted to make sure.
James
James
ASKER
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.
Thanks.
RunningTotal-Formula.jpg
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.
Thanks.
RunningTotal-Formula.jpg
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:
WhilePrintingRecords;
Shared NumberVar ShareSales
You could change that formula to:
WhilePrintingRecords;
Shared NumberVar ShareSales;
Shared NumberVar TotalSales;
TotalSales := TotalSales + ShareSales;
ShareSales
Then you could use a formula like the following in the report footer to output the grand total:
WhilePrintingRecords;
Shared NumberVar TotalSales
James
WhilePrintingRecords;
Shared NumberVar ShareSales
You could change that formula to:
WhilePrintingRecords;
Shared NumberVar ShareSales;
Shared NumberVar TotalSales;
TotalSales := TotalSales + ShareSales;
ShareSales
Then you could use a formula like the following in the report footer to output the grand total:
WhilePrintingRecords;
Shared NumberVar TotalSales
James
ASKER
What is the variable/formula for TotalSales? I got 0.00 result in sub report.
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?
James
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?
James
ASKER
In subreport , the result only shown in Ga Section.