Page 1 of 1

restricting number for fields

Posted: November 24th, 2016, 10:30 pm
by Titus
dear forum,
1.I need to restrict a field to accept only 4 numbers during entry
2. I need to restrict field not to accept zero during entry.

kindly someone help me iam in trouble.

thank you
titus

Re: restricting number for fields

Posted: November 24th, 2016, 11:58 pm
by khurshid.arshad
Dear Titus

1.I need to restrict a field to accept only 4 numbers during entry

Code: Select all

numeric findlength=length(strip(maketext("%d",variablename)));
if  findlength<4 then

errmsg ("Answer is not correct.");
reenter;
else
endif;
2. I need to restrict field not to accept zero during entry.

There are two options:

Option 1:

Code: Select all


If variablename= 0 then

errmsg ("You can not enter [...Zero...]", );
reenter;
else
endif;
Option 2

You can set range other than {0} in the value set labels.

a.

Re: restricting number for fields

Posted: November 25th, 2016, 4:13 am
by Titus
thanks very much khurshid.
it worked well

Re: restricting number for fields

Posted: November 25th, 2016, 6:29 am
by Titus
thanks khurshid, hope am not bothering you a lot , am new to Cspro, am under crisis please, now have tried to put a command for multiple responses so that am able to select more than one responses in tablet. kindly help me please.