水晶报表:如何将参数从子报表传递到父报表? [英] Crystal Reports: How to pass a parameter from a subreport to the parent report?

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

问题描述

我有一些子报表,其中我计算总计。在主报告中,我需要这些总和的总和。

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;

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆