Cascading From LGA to Settlements not displaying Value and labels of the Cascaded Fields

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

Cascading From LGA to Settlements not displaying Value and labels of the Cascaded Fields

Post by lmoriba »

Dear CSPRO Community,
Am in need of urgent help to display values and Labels in the cascaded field. Am cascading the values of my unique identifier field LGA, District, Ward and Settlements using pre-loaded data. The logic below is displaying the Values and not the labels. I need to display both. For instance the logic for district is given below:

onfocus

locateThisGeoID = maketext("%v00000000", LGA);

idx = 1;
do while locate(ITC2021_GEOCODES_DICT,>,locateThisGeoID);
if retrieve(ITC2021_GEOCODES_DICT) then
if GEO_LGA = LGA then
vsCodes(idx) = GEO_DISTRICT;
vsLabels(idx) = maketext("District #%v", GEO_DISTRICT);
inc(idx);
endif;
locateThisGeoID = maketext("%v%v999999", GEO_LGA, GEO_DISTRICT);
endif;
enddo;

vsCodes(idx) = NotAppl;

setcapturetype(DISTRICT, 1); // make this a radio button
setvalueset(DISTRICT, vsCodes, vsLabels);


The logic Compiles fine and cascaded District code and Labels them as District1, District2 etc. Instead displaying the actual value labels. A copy of the program is attached.
Doc2.docx
(30.5 KiB) Downloaded 143 times
PRETRAINING.zip
(163.11 KiB) Downloaded 135 times
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Cascading From LGA to Settlements not displaying Value and labels of the Cascaded Fields

Post by josh »

You can get the label from the value set using the getlabel() function. It takes two arguments, first is the name of the variable or value set to get the label from and the second is the code that you want the label of. So in your example you can do:

Code: Select all

				vsLabels(idx) = getlabel(DISTRICT_VS1, GEO_DISTRICT);	


This tells to CSPro to get the label in the value set DISTRICT_VS1 corresponding to the current value of the variable GEO_DISTRICT from the lookup file.
lmoriba
Posts: 56
Joined: June 10th, 2018, 6:21 pm

Re: Cascading From LGA to Settlements not displaying Value and labels of the Cascaded Fields

Post by lmoriba »

Thanks 😊👍, that is exactly the solution am looking forward to. Thanks a million times.
Post Reply