Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays in Crystal 8.5

Status
Not open for further replies.

Tease

Programmer
Sep 19, 2002
5
GB
Does anyone know if is possible to populate an array from a field. Then to report back on various values at different positions within the array in the footer.
 
Sure you can...just explain your problem to us Jim Broadbent
 
Thanks Guys, i have gotten the thing working but have hit the max of 30000 loops. As i have to sort the array, (i have an array with maybe 1000 records in.) and therefore use two do loops, this has proved an insurmoutable obstacle.

Does anyone know if version 9 still has this restriction?
 
I worked on an interesting routine for sorting that was quite simple using the Maximum function that may get around your problem of 30,000 loops

Essentially you would figure out the maximum value of an array and assign it to a new array. Then set the value of the original element to null and do the test again....repeat until all array elements have been transfered to the new array.

Something like this (both arrays would be initialized to the same size elsewhere.

@SortArray

WhilePrintingRecords;

//both arrays would be initialized to the same size
//elsewhere.
Stringvar array Original;
Stringvar array Final; //initialized to null
numberVar temp;
numberVar m;
numberVar k;

for m := 1 to ubound(Original) do
(
temp := Maximum(Original);
if temp = "" then
exit for
else
(
Final[m] := temp;
for k := 1 to ubound(Original) do
(
if Original[k] = temp then
(
Original[k] = "";
exit for;
);
);
);
);

I don't know if this violates the 30,000 loop rule or not but I thought it was a neat little routine. If your array is numbers then convert them to strings for this routine.

Jim Broadbent
 
arrgghhh!!! that should be


if Original[k] = temp then
(
Original[k] := "";
exit for;
);

in the above formula
Jim Broadbent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top