0

This is the sample layout of my crystal report...

expenses and amount are from subreport while the project name is in the main report.

        Project Title:         Expenses        Amount

Name of Project1            Item1.1         0.00
                                       Item1.2         0.00
                                       Item1.3         0.00

Name of Project2            Item2.1         0.00
                                       Item2.2         0.00

TOTAL:                                               0.00

I tried using this solution: Crystal Reports: How to pass a parameter from a subreport to the parent report? but the problem is, it only return the last group total (in this case total expenses of Name of Project2 only and expenses in Project1 is not included in the total).

Please help. Thanks! :) God bLess!

4

2 回答 2

0

您可以在主报表中使用全局变量来存储您通过共享变量从子报表传回的累计金额。

global numbervar mainTotal;
shared numbervar subReportAmount;
mainTotal := mainTotal + subReportAmount

真的,如果可以的话,我建议完全取消子报告。这样做比在主报告中连接所有表或使用 SQL 表达式要复杂得多,容易出错,而且速度要慢得多。

于 2012-09-06T01:26:14.827 回答
0

我必须同意 Ryan 的意见,丢掉子报告。使用组和运行总计来提供您需要的总计。布局将与此类似:

 Report Header: <subdued> 
 Page Header:    Project Title         
 Expenses        Amount Group Header 1: Name of Project1            
 Detail:                                Item1.1         0.00 
 Detail:                                Item1.2         0.00 
 Detail:                                Item1.3         0.00
 Group Footer: <use as space between groups or add a subtotal>
 Group Header 1: Name of Project2             
 Detail:                                 Item2.1         0.00 
 Detail:                                 Item2.2         0.00 
 Group Footer: <use as space between groups or add a subtotal>
 Report Footer:   TOTAL:                                 0.00 
 Page Footer:                                           Page x of y
于 2012-09-07T01:45:57.897 回答