Dear CSPro Team,
I want to know about multiple option (Alpha) Question,
suppose I have few items like
Item1 A
Item2 B
Item1 C
Item2 D
and now I want to restrict entry of any code other than ABCD. Code must be in ABCD.
Now I am using this Code
string validalpha = "ABCD";
do numeric i = 1 while i <= length(strip(Q10000))
string char = Q10000[i:1];
if pos (char, validalpha) = 0 | (pos(char, Q10000[i+1])) then
errmsg("Invalid character '%s' or you are entering it twice. Only the following characters are allowed: %s", char, validalpha);
reenter;
endif;
enddo;
endif;
but I want to know that in place of ""string Validapha"" is there any other function which will automatically check the codes. There should not be need of defining codes like ABCD.
Thank you
Multiple Response
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
Re: Multiple Response
You should create a valueset in the dictionary that defines A, B, C, and D as the valid values for these variables, then use the check box capture type on entry:
https://www.csprousers.org/help/CSPro/radio_button.html
Sherrell
https://www.csprousers.org/help/CSPro/radio_button.html
Sherrell
Last edited by sherrell on July 26th, 2022, 10:04 am, edited 1 time in total.
-
- Posts: 8
- Joined: May 24th, 2022, 3:29 pm
Re: Multiple Response
Thanks for the reply....
The thing is that this is multiple choices and I am using laptop for data collection.
The thing is that this is multiple choices and I am using laptop for data collection.
Re: Multiple Response
I just corrected my reply, I meant check box. Sorry for the confusion!
-
- Posts: 8
- Joined: May 24th, 2022, 3:29 pm
Re: Multiple Response
What if I want to use text box. Is there any way...
-
- Posts: 1777
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Multiple Response
You can seek (search) for a code in the value set's list of codes. For example:
if VALUE_SET_NAME.codes.seek("A") = 0 then
errmsg("'A' is not in the value set");
reenter;
endif;
You would replace VALUE_SET_NAME with your item's value set, and "A" with each checkbox option.errmsg("'A' is not in the value set");
reenter;
endif;