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

Maximum number of loops (For..Next)

Status
Not open for further replies.
Joined
Nov 5, 2001
Messages
339
Location
GB
Crystal's web site says that the max number of array elements (in v8) is 1000.

I have a bubble sort that tries to sort about 260 array elements and I'm getting the message:

"A loop was evaluated more than the maximum number of times allowed"

As a bubble sort looks like this:

For x = 1 to Ubound(array)
For y = 1 to ubound(array)-1
<Do stuff>
Next y
Next x

...and array has 260 elements, I think I'm getting the error. Can anyone confirm this or suggest a workaround? Steve Phillips, Crystal Consultant
 
Have you tried reducing the number of elements in your array(if possible) and adding a counter to see how many times the loop is looping?

Mike

 
SM,
I just realized (aka really thought about it) what the problem is.

You are attempting to perform 67,340 total loops using an array with 260 elements. Or 260 loops consisting of 259 loops.





Mike

 
Exactly Mike. I was working at a client site at the time and could not find a good solution so abandoned the sort routine.

I haven't got access to Crystal right now but as you suggested first time, I suspect that if you try a FOR..NEXT loop with more than 1000 iterations, you probably get this error.

That's quite limiting if you are trying to perform a bubble sort on an array because of number of iterations it needs.

I'll have to pick up on this another time - if I ever need to!

Thanks anyway though.
Steve. Steve Phillips, Crystal Consultant
 
Apparently in V8 of crystal, the maximum number of loops in a formula is 30,000. Now we know. Steve Phillips, Crystal Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top