We help IT Professionals succeed at work.

Crystal Report  XI Issue : Shared Value from Subreport not shown in the right link

azizi jaafar
azizi jaafar asked
on
132 Views
Last Modified: 2015-08-11
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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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.
CERTIFIED EXPERT

Commented:
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

Author

Commented:
Thanks, Got it
CERTIFIED EXPERT

Commented:
OK.  Just wanted to make sure.

 James

Author

Commented:
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
CERTIFIED EXPERT

Commented:
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

Author

Commented:
What is the variable/formula for TotalSales? I got 0.00 result in sub report.
CERTIFIED EXPERT

Commented:
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
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.