You can do this. It's a little tricky but not too bad.
The trick with this is in how crystal times operations. You have to get your array filled before you do anything with it display wise.
You can build a report with a subreport in the footer. The main report has all your data operations that fill the array. The subreport does any remaining work. You suppress the majority of the main report and have the subreport do the display as if it were the main report.
The reason for this is that crystal will perform operations on the main report first, and then it will work on the subreport. You are fooling crystal into doing all the array construction before it shows anything.
Your array has to be a shared variable or it won't go to the subreport.
shared numbervar array arrLastYrYTD01;
You have to redim it:
shared numbervar maxarraysize:=1000;
redim arrLastYrYTD01[maxarraysize];
You may have to initialize the values with a do loop or for-next
for x:=1 to maxarraysize
Do
(
arrLastYrYTD01[x]:=1;
...etc.
Obviously that isn't always going to be necessary.
Then you fill the array with values:
shared numbervar array arrLastYrYTD01;
shared numbervar maxarraysize;
numbervar counter;
local numbervar numValue:=(Sum ({@numTaxPdLastYearYTD}, {@Groups01License}));
if numValue=0 then
0
else (
select counter
Case 1 to 1000:
arrLastYrYTD01[counter]:=numValue
...etc.
You increment your counter at the end of this so that it advances with each record. You can do it inside the same formula.
Then you set up your subreport to look like a main report, you have to initialize the array there as well, redim preserve
redim preserve arrLastYrYTD01[maxarraysize];
I'm not 100% sure that last step is necessary but I'm going to leave it in my code.
Then you should have an array that your subreport can work with to it's heart's content.
In this example, I had to find the rank of a set of things according to three different columns and display all three ranks. I got around the 1000 point limit in the arrays with 10 arrays and some if-then logic to deposit the values into the correct array using the counter. Then I used a for-next loop to compare each given value to all the others in the array (asking if the item was greater than or equal to and then incrementing a counter if it was).
Anyway, that's an example that worked pretty well. Let me know if you need to see the complete code. I kept it brief here for readability.
Scott.