本文介绍了Crystal Reports:如何将参数从子报表传递到父报表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多子报表用于计算总计.在主报告中,我需要这些总数的总和.

I have a number of subreports in which I calculate totals. In the main report I need the sum of those totals.

我不知道如何访问子报表中的总数.

I don't know how to get acces to the totals in the subreports.

推荐答案

你需要考虑使用共享变量,它可以被父报表和子报表读写.

You need to look into using Shared Variables, which can be read and written to by both the parent report and its subreports.

例子:

在父报表中,用于初始化事物的公式称为InitTotal",包含以下文本:

In parent report, a formula to initialise things called 'InitTotal', containing the text :

Shared NumberVar MyTotal := 0;

将此公式放在报表标题中并禁止显示.向每个名为AddTotal"的子报表添加一个公式,其中包含以下文本:

Place this formula in the report header and suppress it. Add a formula to each subreport called 'AddTotal', containing the text :

Shared NumberVar MyTotal := MyTotal + {FieldToAddToTotal};

将此公式添加到子报表的报表页脚并隐藏它.

Add this formula to the subreport's report footer and suppress it.

最后,在父报表的报表页脚中,添加另一个名为DisplayTotal"的公式,其中仅包含文本:

Finally, in the report footer of the parent report, add another formula called 'DisplayTotal' containing just the text :

Shared NumberVar MyTotal;

这篇关于Crystal Reports:如何将参数从子报表传递到父报表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 07:54