Crystal 报告从公式返回的总值 运行

Crystal Reports running total on value returned from a formula

我有一个公式可以从数据库 xml 字段中提取值并将其显示在我的报告的详细信息中。我正在尝试计算各种答案,但我的全局变量不适用于 运行 总设置,报告中的“采取的行动”值也不可用。

有没有办法让全局变量的总数达到 运行,还是我做错了?

公式如下:

stringvar array x := split({msgMessages.XmlMessage},"</");
numbervar i := 0;
numbervar j := ubound(x);
stringvar array y := "";
numbervar k := 0;
global numbervar SA;
global numbervar RA;
global numbervar CA;
global numbervar VA;
global numbervar TC;
global numbervar PWCB;
global numbervar CCWO;


for i := 1 to j do(
if instr(x[i], "<ACTIONTAKEN>") <> 0 then(
k := k + 1;
redim preserve y[j];
y[k] := extractstring(x[i],"<ACTIONTAKEN>","</ACTIONTAKEN>"))[i]);

whileprintingrecords;
stringvar array y;
select y[1] 
case "Scheduled Appointment" :  SA = SA + 1
case "Rescheduled Appointment" : RA = RA + 1
case "Cancelled Appointment" : CA = CA + 1
case "Verified Appointment" : VA = VA + 1
case "Transferred Call" : TC = TC + 1
case "Patient Will Call Back" : PWCB = PWCB + 1
default: CCWO = CCWO + 1;

y[1]


改变

whileprintingrecords;

whilereadingrecords;