Dynamic Value Sets from Checkboxes

Discussions about creating CAPI applications to run on Android devices
Forum rules
New release: CSPro 8.0
gbos
Posts: 51
Joined: June 18th, 2015, 7:49 pm

Re: Dynamic Value Sets from Checkboxes

Post by gbos »

:D :D Many thanks my dear friend khurshid . This has solved my problem, absolutely. Your solution is so beautiful and is not one i ever knew before. So, thanks a million times.

Regards
........
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dynamic Value Sets from Checkboxes

Post by josh »

To use the isChecked function you would just change the logic in @khurshid.arshads example to:

Code: Select all

	if isChecked("01", S4Q7) then A_WHEATHER = 1 else A_WHEATHER = 2; endif;
	if isChecked("02", S4Q7) then B_CROP_VARIETIES = 1 else B_CROP_VARIETIES = 2; endif;
	if isChecked("03", S4Q7) then C_NEW_AGRICULTURAL_PRACTICE = 1 else C_NEW_AGRICULTURAL_PRACTICE = 2; endif;
	etc...
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Dynamic Value Sets from Checkboxes

Post by khurshid.arshad »

Dear Josh
Thanks for this code. In my code, we can assign only one option "Yes" OR "NO".

I have tried ischecked function but it is not working. The error message is:
ERROR: 'isChecked' is not a declared variable or is a misspelled dictionary entry
ERROR: Single variable - cannot have subscript (unexpected left parenthesis) near line 4 in S4Q7 procedure


I have Version 7.0.2 dated 29 June 2017 and 7.1.0 (beta) dated 21 November 2017.

Please advice.
thanks.
a.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Dynamic Value Sets from Checkboxes

Post by josh »

You need to add the function isChecked in the proc global. See attached.
Attachments
CHECK ALL THAT APPLIES.zip
(5.44 KiB) Downloaded 327 times
Post Reply