Multiple questions in data entry on desktop

Discussions about CSEntry
Komin
Posts: 58
Joined: July 23rd, 2016, 1:27 pm

Multiple questions in data entry on desktop

Postby Komin » February 22nd, 2018, 10:50 am

Dear cspro team,

This is my questions
Q1: Which subject do you study? (Multiple question)
A=1
B=2
C=3
D=4

I designed var in cspro as below
Q1.a
Q1.b
Q1.c
Q1.d

I want data entry as below
Q1.a=1
Q1.b=blank
Q1.c=3
Q1.d=blank

Could you please advice me, how to write code? :?:

Regards
Komin

josh
Posts: 1540
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Multiple questions in data entry on desktop

Postby josh » February 23rd, 2018, 11:51 am

You need to explain this more. Is Q1 a single variable in your dictionary with value set a, b, c, d or do you have four separate questions q1a, q1b, q1c, q1d? What is the desired behavior when you say you want "Q1. a = 3"? Is this what the user is entering or are you setting the value from logic?

Komin
Posts: 58
Joined: July 23rd, 2016, 1:27 pm

Re: Multiple questions in data entry on desktop

Postby Komin » February 24th, 2018, 5:15 am

Dear Josh,

Yes I have four var separated q1a, q1b, q1c, q1d.
But in q1a, I want input value 1 or blank only. How can I write the logic?

Regards
Komin

josh
Posts: 1540
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Multiple questions in data entry on desktop

Postby josh » February 24th, 2018, 8:33 am

You could make a value set that only contains 1 and notappl (in CSPro notappl is how you refer to blank). CSPro will not let you enter values outside the value set.

You could also use logic to verify that only blank or 1 is entered:

postproc

if not $ in 1, notappl then
    
errmsg("Must be 1 or blank");
endif;


Note that in either case to allow entry of blank you will need to use the setproperty function to set "CanEnterNotAppl" to "NoConfirm" for your field as CSPro generally does not allow entry of blank. See help on setproperty for more details. Normally in CSPro you use blank to indicate a question has been skipped and you use a different value for non-response (often code 9).

Komin
Posts: 58
Joined: July 23rd, 2016, 1:27 pm

Re: Multiple questions in data entry on desktop

Postby Komin » February 25th, 2018, 3:20 am

Dear Josh,

Could please tell me the function CanEnterNotAppl to noconfirm in field?

Regard
Komin

josh
Posts: 1540
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Multiple questions in data entry on desktop

Postby josh » February 25th, 2018, 8:33 am

See the help for the function setproperty (http://www.csprousers.org/help/CSPro/se ... ction.html). You can call setproperty anywhere in your logic BEFORE the field that you want to allow blanks for including the preproc of the field itself.

Komin
Posts: 58
Joined: July 23rd, 2016, 1:27 pm

Re: Multiple questions in data entry on desktop

Postby Komin » March 3rd, 2018, 7:20 am

Dear Josh,

Could you please give me a real script?

Regards
Komin

Gregory Martin
Posts: 997
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Multiple questions in data entry on desktop

Postby Gregory Martin » March 5th, 2018, 9:57 am

This is an example of how to set the property in logic:

PROC FIELD_NAME

preproc

    setproperty(FIELD_NAME,"CanEnterOutOfRange","NoConfirm");

postproc

    if not FIELD_NAME in 1,notappl then
        errmsg("Must be 1 or blank");
        reenter;
    endif;


You can also assign blank as Missing as a value to your value set and then you do not have to set this in logic.

kompiler
Posts: 23
Joined: January 25th, 2017, 12:38 pm

Re: Multiple questions in data entry on desktop

Postby kompiler » March 19th, 2018, 8:44 am

Dear CSPro Users,

I am using CSPro 7.0.2. Could you please explain why I cannot use the "setproperty" function. The system does not recognize it as a built-in function.

sah
Posts: 93
Joined: May 28th, 2015, 3:16 pm

Re: Multiple questions in data entry on desktop

Postby sah » March 19th, 2018, 11:15 am

Setproperty function is new command introduced and works with CSpro 7.1 which is yet to be leased soon. If you are comfortable with the 7.1 beta then you can use it for your setup.


Return to “Entry”