formulacrystal-reports-2008

Crystal Reports running total on value returned from a formula


I have a formula that extracts a value from a DB xml field and displays it in the details of my report. I'm trying to do a count on the various answers, but my global variables are not available to the running total setup, and neither is the Action Taken values on the report.

Is there a way to get the global variables into a running total, or am I going about this wrong?

The formula is as follows:

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]



Solution

  • Change

    whileprintingrecords;
    

    to

    whilereadingrecords;