Categories
.NET

关于水晶报表分页统计的开发经验

最近在修改学校的程序的发现个很大的问题,水晶报表运行总计字段的统计功能是针对整份报表的,而一般单页页脚的统计是针对当前页的。翻了半天business objects的文档,没有找到,后来google了半天,总算找到了解决方法。使用公式编辑器的自定义字段公式,主要使用whileprintingrecords;这个命令,这是当页面写入时调用此命令下的程序。
 

stu_insurance_1

stu_insurance_2
 

formula_1
whileprintingrecords
;
global numbervar BFtotal;
global numbervar RStotal;
global numbervar BTtotal;
BFtotal:=0;
RStotal:=0;
BTtotal:=0;

 

formula_2
whileprintingrecords
;
global numbervar BFtotal;
global numbervar RStotal;
global numbervar BTtotal;
BFtotal:=BFtotal+{VIEW1.保费};
RStotal:=RStotal+1;
BTtotal:=BTtotal+{VIEW1.补贴};

 

本页保费
whileprintingrecords
;
global numbervar BFtotal;


本页补贴
whileprintingrecords
;
global numbervar BTtotal;


本页人数
whileprintingrecords
;
global numbervar RStotal;

formula_1是页面的初始化,主要是清零操作,需要存放在页面的最初,页眉处。
formula_2是每次调用的计数,存放在计数体内部,这里我放在了详细资料内。
而最后的本页保费、本页补贴、本页人数存放在页脚的用作计数统计的显示使用。