水晶报表中的全局变量 [英] Global variable in crystal reports
问题描述
我正在尝试在水晶报表中保持教师、支持人员和管理人员的总数,我决定使用全局变量来做到这一点,我知道这可以通过其他方式实现,但我想给出全局变量变量.
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
制作这个:[刘易舍姆] 经理: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屋!