水晶报表,子报表和共享变量 [英] Crystal reports, sub-reports, and shared variables

查看:118
本文介绍了水晶报表,子报表和共享变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面标题中有一个公式@InitVars,其中包括以下内容和类似的行:

I have a formula @InitVars in the page header which includes the following, and similar lines:

shared numbervar runWaste:=0;

在详细信息v中,我有一个子报表,其公式为@SetRunWaste:

In Details v, I have a sub-report, which has a formula @SetRunWaste:

shared numbervar runWaste;
if (OnFirstRecord) then
(
if not(isnull({x.x-or})) and 
not(isnull({x.y-override})) and {x.y-override} = true then
runWaste:={x.x-or} 
  else
runWaste:= {x.x}
);
runWaste

我可以在子报表中看到此公式的输出为18.00。

I can see the output of this formula in the sub-report is 18.00.

但是,在另一个子报表中,在Details az中,以及在主报表中在Details w中(作为测试),我都有以下公式@test:

However, both in another sub-report, in Details az, and in the main report in Details w (as a test), I have the following formula @test:

shared numbervar runWaste;
runWaste;

在两个地方都显示为0.00。

In both places, it shows as 0.00.

为什么显示0而不是18?

Why is it showing 0 not 18?

我正在使用Crystal Reports版本11.0.0.895。

I'm using Crystal Reports version 11.0.0.895.

推荐答案

问题是@InitVars位于页面标题中,而不是报表标题中。它将在每个页面的顶部将变量重置为0。

The problem is that @InitVars is in the page header, not the report header. It is resetting the variable to 0 at the top of every page.

将@InitVars移动到报表标题已对其进行了修复,因此正确的数字出现在 Details(详细信息)的子报表中。

Moving @InitVars to the report header fixed it so the correct number comes up in the sub-report in Details az.

当我在主报表中包含变量时,我仍然看到一些奇怪的行为,但是由于那只是为了调试,而不是主要目标,所以我不在乎。

I still see some odd behavior when I include the variable in the main report, but since that was just for debugging, not the main target, I don't care.

这篇关于水晶报表,子报表和共享变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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