Want to throw an Error Message on 4th Character

Stivan_dsouza21Stivan_dsouza21 Member Posts: 218
While Entering PAN No in Vendor Card, Want to throw an error message when i m Entering the 4th character and it does not match the below caharcters C P H F A T B L J G.

I have written the below code on PAN No. on Validate at table level but the code is not triggering:

IF (STRLEN("P.A.N. No.") = 4 ) THEN
BEGIN

IF NOT ("P.A.N. No." = 'C') OR ("P.A.N. No." = 'P') OR ("P.A.N. No." = 'H') OR ("P.A.N. No." = 'F') OR
("P.A.N. No." = 'A') OR ("P.A.N. No." = 'T') OR ("P.A.N. No." = 'B') OR ("P.A.N. No." = 'L') OR
("P.A.N. No." = 'J') OR ("P.A.N. No." = 'G') THEN
ERROR('PAN No. is not valid');
END;

Can somebody help me out.
Thanks & Regards,
Stivan D'souza

Comments

Sign In or Register to comment.