Fields with only Number and alphabet not special character

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Purushottam
Posts: 4
Joined: April 19th, 2013, 8:13 am

Fields with only Number and alphabet not special character

Post by Purushottam »

I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character

Pl help
khurshid.arshad
Posts: 572
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: Fields with only Number and alphabet not special charact

Post by khurshid.arshad »

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.
Bharadwaj

Re: Fields with only Number and alphabet not special charact

Post by Bharadwaj »

Purushottam wrote:I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character

Pl help
Hi Purushottam

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.
Purushottam
Posts: 4
Joined: April 19th, 2013, 8:13 am

Re: Fields with only Number and alphabet not special charact

Post by Purushottam »

Bharadwaj wrote:
Purushottam wrote:I want logic for Fields(Alpha) that accept only Number (0-9) and alphabet (A-Z) not special character

Pl help
Hi Purushottam

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
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: Fields with only Number and alphabet not special charact

Post by Gregory Martin »

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;
Post Reply