Multiple Response

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
rksraajput
Posts: 8
Joined: May 24th, 2022, 3:29 pm

Multiple Response

Post by rksraajput »

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
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Multiple Response

Post by sherrell »

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
Last edited by sherrell on July 26th, 2022, 10:04 am, edited 1 time in total.
rksraajput
Posts: 8
Joined: May 24th, 2022, 3:29 pm

Re: Multiple Response

Post by rksraajput »

Thanks for the reply....

The thing is that this is multiple choices and I am using laptop for data collection.
sherrell
Posts: 397
Joined: April 2nd, 2014, 9:16 pm
Location: Washington, DC

Re: Multiple Response

Post by sherrell »

I just corrected my reply, I meant check box. Sorry for the confusion!
rksraajput
Posts: 8
Joined: May 24th, 2022, 3:29 pm

Re: Multiple Response

Post by rksraajput »

What if I want to use text box. Is there any way...
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Multiple Response

Post by Gregory Martin »

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.
Post Reply