Add extra option in array
Posted: September 1st, 2016, 9:38 am
Dear Team
I am using this code from example and i want add extra code in the end for "Do't Know" after populate the list.
aDistrictCodes(i-1) = 999;
aDistrictNames(i-1) = "Don't Know";
Thanks.
arshad
I am using this code from example and i want add extra code in the end for "Do't Know" after populate the list.
aDistrictCodes(i-1) = 999;
aDistrictNames(i-1) = "Don't Know";
Thanks.
arshad
Code: Select all
Preproc
{ use lookup file to load all sectors for district entered }
LF_DISTRICT_ID = Q_1_2;
if loadcase(SECTOR_DICT, LF_DISTRICT_ID) = 0 then
errmsg("Invalid District, please reenter");
Move to Q_1_2;
endif;
{ Copy the district codes and names for the selected province into arrays.
Note that the AREA_REC record repeats (max occurences of 99) so when we
load the case for a given province, we get one occurence of AREA_REC
for each district in the given province. }
do varying i = 1 until i >= count(SECTOR_DICT.SECTOR_REC)
{ the arrays that we use for setvalueset start at 0 so we use i-1! }
aDistrictCodes(i-1) = LF_SEC_ID(i);
aDistrictNames(i-1) = LF_SEC_NAME(i);
enddo;
aDistrictCodes(i-1) = notappl; { mark end of array with a code = notappl}
{so that setvalueset knows how many elements}
{ in the array to use }
{ call setvalueset using the arrays that contain district codes and names }
setvalueset(Q_2_3_4, aDistrictCodes, aDistrictNames);