水晶报告中的全局变量 [英] Global variable in crystal reports

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

问题描述

我正在努力让水晶报告中的教师,支持人员和管理人员保持一致,我决定使用全局变量来做到这一点,我知道这可能会以其他方式实现,但我想给全局变量a去。

I'm trying to keep a running total of teachers, support staff and managers in crystal reports, I've decided to do this using global variables, I know it'd be possible in other ways but I want to give global variables a go.

    WhileReadingRecords;
Global NumberVar TotalSManagement;
Global NumberVar TotalSTeachers;
Global NumberVar TotalSSupport;
Global NumberVar TotalLManagement;
Global NumberVar TotalLTeachers;
Global NumberVar TotalLSupport;

if{staff_addresses_txt.Staff category} = "MANA" and {staff_addresses_txt.Name} = "CTK:Lewisham" then
    TotalLManagement = TotalLManagement + 1
else
if{staff_addresses_txt.Staff category} = "TEAC" and {staff_addresses_txt.Name} = "CTK:Lewisham" then
    TotalLTeachers = TotalLTeachers + 1
else
if{staff_addresses_txt.Staff category} = "SUPP" and {staff_addresses_txt.Name} = "CTK:Lewisham" then
    TotalLSupport = TotalLSupport + 1
else
if{staff_addresses_txt.Staff category} = "MANA" and {staff_addresses_txt.Name} = "CTK:St Mary's" then
    TotalSManagement = TotalSManagement + 1
else
if{staff_addresses_txt.Staff category} = "TEAC" and {staff_addresses_txt.Name} = "CTK:St Mary's" then
    TotalSTeachers = TotalSTeachers + 1
else
if{staff_addresses_txt.Staff category} = "SUPP" and {staff_addresses_txt.Name} = "CTK:St Mary's" then
    TotalLSupport = TotalLSupport + 1;

if语句肯定会触发,但是当我显示页面底部的总数时使用下面的代码,一切都是0.00:

The if statements are definitely firing, but when I come to display the totals at the bottom of the page using the following code, everything is 0.00:

Global NumberVar TotalSManagement;
Global NumberVar TotalSTeachers;
Global NumberVar TotalSSupport;
Global NumberVar TotalLManagement;
Global NumberVar TotalLTeachers;
Global NumberVar TotalLSupport;

if {staff_addresses_txt.Name} = "CTK:Lewisham" then
 "[Lewisham] Managers: " & TotalLManagement & " | Teachers: " & TotalLTeachers & " | Support: " & TotalLSupport
else
 "[Sidcup] Managers: " & TotalSManagement & " | Teachers: " & TotalSTeachers & " | Support: " & TotalSSupport

生产:
[Lewisham]经理人:0.00 |教师:0.00 |支持:0.00

Producing this: [Lewisham] Managers: 0.00 | Teachers: 0.00 | Support: 0.00

我是否错误地使用全局变量?我曾尝试用其他数字初始化它们,但响应总是相同的。任何想法?

Am I using global variables incorrectly? I have tried initialising them with other numbers, but the response is always the same. Any ideas?

推荐答案

你永远不会为你的变量赋值任何值。 :=是赋值运算符,不是=。另外,为了安全起见,页脚公式应该有WhilePrintingRecords;在顶部。

You're never assigning your variables any values. ":=" is the assignment operator, not "=". Also, to be on the safe side, the footer formula should have WhilePrintingRecords; at the top.

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

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