well, there is just one test, it would be easy...
create a formula for the sum, in it create a shared variable, assign it the value of the sum, then display the sum. In the next year, do the same thing and then you can display your variance but.... I'm betting that there is more than 1 test in a year.
as an outline, here's what I do
create a string that holds the years you are testing (I am guessing that there may be more than 2, or a new/old test that only occurs in year)
create a string that holds the year, test, cases. When you want the variance you find the parts of the string and display them. An array would be easier, but in CR you only have 1-D arrays, so you would need several arrays.
I was thinking something like this. I would probably put it in 2nd group footer:
shared stringvar sYears; //may not be needed
shared stringvar results;
local numbervar cases := count({table.field}, {group.criteria});
if results = "" then results := "|";
results := results + totext({table.yearField},0,"") + "^" + {table.testFeild} + "@" + totext(cases,0,"") + "|" ;
cases; //display the sum
now when you want to get the variance, you have to know 2 things, what year and what test, if you want all of them you will just want to format your textbox to be a) wide enough and b) to grow
you would search for the year/test combo
shared stringvar results;
local numbervar year1;
local numbervar year2;
local numbervar index;
local numbervar index2;
local stringvar search;
// say looking for a year/test
search:="|" + totext(yearWanted, 0,"") +"^" + testWanted+"@";
index := instr(results, search);
if index = 0 then
year1 := 0;
else(
index2 = instr(index + 1,results,"|");
if index2 = 0 then index2 = len(results) + 1;
year1 := val(mid(results, index + len(search), index2 - len(search) - 1);
);
search:="|" + totext(yearWanted-1, 0,"") +"^" + testWanted+"@";
index := instr(results, search);
if index = 0 then
year2 := 0;
else(
index2 = instr(index + 1,results,"|");
if index2 = 0 then index2 = len(results) + 1;
year2 := val(mid(results, index + len(search), index2 - len(search) - 1);
);
if year1 = 0 or year2 = 0 then
0; //variance ??? or whatever value you want
else
year1 / year2;
didn't think it would be this long.
you can of course modify it as needed, but hopefully it is a path.