Crystal Reports 2013 SP 2 P 1
I need to figure out how to sort a large array. I am getting an error "A Loop was evaluated more than the maximum number of times allowed."
This happens whether I use a bidirectional bubble sort (which I can understand since the iterations become large)
or a gnome sort.
I saw somewhere that an array size of 455 was the limit for bubble sort, but the solutions referred had dead links.
I'm looking to either use a sorting algorithm that won't produce an error for large arrays, or as I'm building the array, input each new element in a sorted fashion.
I need to figure out how to sort a large array. I am getting an error "A Loop was evaluated more than the maximum number of times allowed."
This happens whether I use a bidirectional bubble sort (which I can understand since the iterations become large)
Code:
Global numbervar array Arrival_to_Dispo_grpx;
local numbervar loop1 := 0;
local numbervar loop2 := 0;
local numbervar temp := 0;
//
for loop2:=1 to ubound(Arrival_to_Dispo_grpx)-1 do(
for loop1:=1 to ubound(Arrival_to_Dispo_grpx)-loop2 do(
if Arrival_to_Dispo_grpx[loop1] > Arrival_to_Dispo_grpx[loop1+1] then
(temp := Arrival_to_Dispo_grpx[loop1];
Arrival_to_Dispo_grpx[loop1] := Arrival_to_Dispo_grpx[loop1+1];
Arrival_to_Dispo_grpx[loop1+1] := temp)));
or a gnome sort.
Code:
Global numbervar array Arrival_to_Dispo_grpx;
Local NumberVar Array Sorting_Array := Arrival_to_Dispo_grpx;
Local NumberVar i := 2;
Local NumberVar temp_value;
while ( i < ( ubound(Sorting_Array) + 1 ))
do
(
if ( Sorting_Array [i - 1] <= Sorting_Array [i] )
then
i := i + 1
else
(
temp_value := Sorting_Array [i - 1];
Sorting_Array [i - 1] := Sorting_Array [i];
Sorting_Array [i] := temp_value;
i := i - 1;
if ( i < 2 ) then i := 2;
);
);
Arrival_to_Dispo_grpx := Sorting_Array;
I saw somewhere that an array size of 455 was the limit for bubble sort, but the solutions referred had dead links.
I'm looking to either use a sorting algorithm that won't produce an error for large arrays, or as I'm building the array, input each new element in a sorted fashion.