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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A loop was evaluated more than the maximum

Status
Not open for further replies.

UHsoccer

Programmer
Apr 24, 2003
139
US
Doing a bubble sort in Crystal 10 the message appears
"A loop was evaluated more than the maximum number of times allowed"
Here is the code for the bubble sort

whileprintingrecords ;
shared numbervar array URLnum;
numbervar loop1; numbervar loop2;
numbervar temp; numbervar loop0 ;

loop0 := ubound(URLnum);
if loop0 > 1 then
(
for loop2 := 1 to ubound(URLnum)-1 do (
for loop1 := 1 to ubound (URLnum)-1 do (
if URLnum[loop1] < URLnum[loop1+1] then
(temp := URLnum[loop1] ;
URLnum[loop1] := URLnum [loop1+1] ;
URLnum [loop1+1] := temp ;)
));)

The values in the error message segment (nice in Crystal 10) are

loop1 = 96, loop2 = 225, loop0 = 445
ubound(URLnum) = 444
How do I get around it and what is the limit anyway?
I did a search on the Knowledge data base at Crystal, but to no avail
 
I have a thread here somewhere which delves into sortation and alternatives to bubble sorting.

Here's a thread I found that should help:

thread149-880327

-k
 
Actually that thread is my own from July-2004 when I was trying to understand the sort and print rules for arrays

While this subject is hot, how do I "zero out" an array?
I tried :

stringvar array URLtemp;
numbervar numUser ;
shared stringvar array URLid;
shared numbervar array URLnum;
if (numUser = 1) then redim URLid[1] else redim URLtemp[1]
// message : The result of a formula cannot be an array


it behaves badly
 
You have it, you just can't have an array as the LAST thing in a formula:

stringvar array URLtemp;
numbervar numUser ;
shared stringvar array URLid;
shared numbervar array URLnum;
if (numUser = 1) then
redim URLid[1]
else
redim URLtemp[1];
"Blah"

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top