Page 1 of 1

How to manage Alphanumeric variables

Posted: November 26th, 2016, 7:37 pm
by MarcOlivier
I have a matter.
I created an alpha on which I would like to make a restriction on it such that it will not be possible to enter both numbers and letters. I would like when it enter both numbers and letters an error message appears.
I would like it will be enter either only number or only letter
Thanks to help me to solve it

Re: How to manage Alphanumeric variables

Posted: November 27th, 2016, 4:56 am
by khurshid.arshad
Dear MarcOlivier;
Maybe it works for you.

Code: Select all

if poschar("0123456789", $)=1 then
		if poschar("abcdefghijklmnopqrstuvwxyz",tolower($))>1 then
			errmsg ("message 1: you can not etnter alpha");
			reenter;
		else
		endif;
	elseif poschar("abcdefghijklmnopqrstuvwxyz", tolower($))=1 then
		if poschar("0123456789",$)>1 then
			errmsg ("message 2: you can not enter number");
			reenter;
		else
		endif;
	endif
a.

Re: How to manage Alphanumeric variables

Posted: November 27th, 2016, 9:44 am
by MarcOlivier
Thank you very much.
It works perfectly :D