水晶报表中的全局变量
我试图在水晶报告中保留教师、支持人员和经理的总数,我决定使用全局变量来做到这一点,我知道可以通过其他方式实现,但我想尝试一下全局变量。
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
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
我是否错误地使用了全局变量?我尝试用其他数字初始化它们,但响应始终相同。有什么想法吗?
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;
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
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您永远不会为变量分配任何值。 “:=”是赋值运算符,而不是“=”。另外,为了安全起见,页脚公式应该有 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.