Condtional ValueSet
Posted: February 23rd, 2018, 10:40 am
Hi
Any one can help me to set valueSet conditionally in CSPro 6.3.
I have tried to this
PROC GLOBAL
numeric i;
array aDistrictCodes(99);
array alpha(32) aDistrictNames(99);
PROC MYPOGRAM_FF
preproc
{ turn on assisted mode for province and district
to get dialog that shows value set entries }
set attributes(PROVINCE, DISTRICT) assisted on (responses);
{ use lookup file to load all districts for province entered }
PROVINCE_CODE = PROVINCE;
if loadcase(AREA_DICT, PROVINCE_CODE) = 0 then
errmsg("Invalid province, please reenter");
reenter PROVINCE;
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(AREA_DICT.AREA_REC)
{ the arrays that we use for setvalueset start at 0 so we use i-1! }
aDistrictCodes(i-1) = DISTRICT_CODE(i);
aDistrictNames(i-1) = DISTRICT_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(DISTRICT, aDistrictCodes, aDistrictNames);
Found Error: Invalid function call (Multiple Record/Group/Item name expected) near line 19 in MYPOGRAM_FF procedure
Thanks in advanced.
Any one can help me to set valueSet conditionally in CSPro 6.3.
I have tried to this
PROC GLOBAL
numeric i;
array aDistrictCodes(99);
array alpha(32) aDistrictNames(99);
PROC MYPOGRAM_FF
preproc
{ turn on assisted mode for province and district
to get dialog that shows value set entries }
set attributes(PROVINCE, DISTRICT) assisted on (responses);
{ use lookup file to load all districts for province entered }
PROVINCE_CODE = PROVINCE;
if loadcase(AREA_DICT, PROVINCE_CODE) = 0 then
errmsg("Invalid province, please reenter");
reenter PROVINCE;
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(AREA_DICT.AREA_REC)
{ the arrays that we use for setvalueset start at 0 so we use i-1! }
aDistrictCodes(i-1) = DISTRICT_CODE(i);
aDistrictNames(i-1) = DISTRICT_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(DISTRICT, aDistrictCodes, aDistrictNames);
Found Error: Invalid function call (Multiple Record/Group/Item name expected) near line 19 in MYPOGRAM_FF procedure
Thanks in advanced.