I am getting the error "A Subscript must be between 1 and size of the array" when I execute this code in my crystal reports formul-- I am using Crystal 2008
stringvar array POPD;
PopD [1] := totext({POPULATION_DISPLAY.FULL_NAME_SORT});
PopD [2] := totext({POPULATION_DISPLAY.USER_NUMBER_SORT});
PopD [3] := totext({POPULATION_DISPLAY.EMAIL_WORK_SORT});
PopD [4] := totext({POPULATION_DISPLAY.DIVISION_SORT});
PopD [5] := totext({POPULATION_DISPLAY.OPERATING_UNIT_SORT});
PopD [6] := totext({POPULATION_DISPLAY.COUNTRY_NAME_SORT});
numbervar loop1;
numbervar loop2;
stringvar temp;
for loop2:=1 to ubound(POPD)-1 do(
for loop1:=1 to ubound(POPD)-loop2 do(
if POPD[loop1] > POPD[loop1+1] then
(temp := POPD[loop1];
POPD[loop1] := POPD[loop1+1];
POPD[loop1+1] := temp)));
stringvar array POPD;
PopD [1] := totext({POPULATION_DISPLAY.FULL_NAME_SORT});
PopD [2] := totext({POPULATION_DISPLAY.USER_NUMBER_SORT});
PopD [3] := totext({POPULATION_DISPLAY.EMAIL_WORK_SORT});
PopD [4] := totext({POPULATION_DISPLAY.DIVISION_SORT});
PopD [5] := totext({POPULATION_DISPLAY.OPERATING_UNIT_SORT});
PopD [6] := totext({POPULATION_DISPLAY.COUNTRY_NAME_SORT});
numbervar loop1;
numbervar loop2;
stringvar temp;
for loop2:=1 to ubound(POPD)-1 do(
for loop1:=1 to ubound(POPD)-loop2 do(
if POPD[loop1] > POPD[loop1+1] then
(temp := POPD[loop1];
POPD[loop1] := POPD[loop1+1];
POPD[loop1+1] := temp)));