I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character
Pl help
Fields with only Number and alphabet not special character
Forum rules
New release: CSPro 8.0
New release: CSPro 8.0
-
- Posts: 4
- Joined: April 19th, 2013, 8:13 am
-
- Posts: 572
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: Fields with only Number and alphabet not special charact
Please use this code in Global
Function OnKey(x);
if getsymbol()="Variable Name" then
if x in 65:90,13, 8, 32, 46, 37:40, 1009 ,48:57,96:105, 1009,190 then
{ Alpha "65:90, 13=Enter, 8=Bksp, 32=Space, 46=Delete; Numeric 48:57, keypad=96:105}
OnKey = x;
else
OnKey = 0;
endif;
else
Onkey = x;
endif;
end;
a.
Function OnKey(x);
if getsymbol()="Variable Name" then
if x in 65:90,13, 8, 32, 46, 37:40, 1009 ,48:57,96:105, 1009,190 then
{ Alpha "65:90, 13=Enter, 8=Bksp, 32=Space, 46=Delete; Numeric 48:57, keypad=96:105}
OnKey = x;
else
OnKey = 0;
endif;
else
Onkey = x;
endif;
end;
a.
Re: Fields with only Number and alphabet not special charact
Hi PurushottamPurushottam wrote:I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character
Pl help
Use simple logic
proc VAR
if not $ in "A":"Z", "0":"9" then
Errmsg("Please enter correct charecter");
reenter;
endif;
This will resolve your problem.
-
- Posts: 4
- Joined: April 19th, 2013, 8:13 am
Re: Fields with only Number and alphabet not special charact
Bharadwaj wrote:Hi PurushottamPurushottam wrote:I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character
Pl help
Use simple logic
proc VAR
if not $ in "A":"Z", "0":"9" then
Errmsg("Please enter correct charecter");
reenter;
endif;
This will resolve your problem.
Thanks Mr Bhardwaj,
I have VAR (PAN) with length 10 (e.g. PAN /TAN no). I want to enter PAN or TAN number with only A:Z and 0:9 only. how to enter on these characters only?
pl suggest
-
- Posts: 1777
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Fields with only Number and alphabet not special charact
To build off what Bharadwaj wrote, you can employ a loop to check all ten characters:
PROC PAN
numeric counter;
do counter = 1 while counter <= length(PAN)
if not toupper(PAN[counter:1]) in "0":"9","A":"Z"," " then
errmsg("Please enter a correct character");
reenter;
endif;
enddo;
numeric counter;
do counter = 1 while counter <= length(PAN)
if not toupper(PAN[counter:1]) in "0":"9","A":"Z"," " then
errmsg("Please enter a correct character");
reenter;
endif;
enddo;