Page 1 of 1

Multiple questions in data entry on desktop

Posted: February 22nd, 2018, 10:50 am
by Komin
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

Re: Multiple questions in data entry on desktop

Posted: February 23rd, 2018, 11:51 am
by josh
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?

Re: Multiple questions in data entry on desktop

Posted: February 24th, 2018, 5:15 am
by Komin
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

Re: Multiple questions in data entry on desktop

Posted: February 24th, 2018, 8:33 am
by josh
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).

Re: Multiple questions in data entry on desktop

Posted: February 25th, 2018, 3:20 am
by Komin
Dear Josh,

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

Regard
Komin

Re: Multiple questions in data entry on desktop

Posted: February 25th, 2018, 8:33 am
by josh
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.

Re: Multiple questions in data entry on desktop

Posted: March 3rd, 2018, 7:20 am
by Komin
Dear Josh,

Could you please give me a real script?

Regards
Komin

Re: Multiple questions in data entry on desktop

Posted: March 5th, 2018, 9:57 am
by Gregory Martin
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.

Re: Multiple questions in data entry on desktop

Posted: March 19th, 2018, 8:44 am
by kompiler
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.

Re: Multiple questions in data entry on desktop

Posted: March 19th, 2018, 11:15 am
by sah
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.