Page 1 of 1

problem in format checking

Posted: Wed Jan 02, 2008 5:03 am
by shaonli
I need to chek format of a field.If the format of the field is 99-999-9999 then one condition should satisfy.
Please suggest how to check the field format.

Re: problem in format checking

Posted: Wed Jan 02, 2008 5:18 am
by Mayur Dongaonkar
Try using combination of following functions

1. Trim
2. Length

Trim function will return digits before occurance delimiter.
e.g. 99-999-9999
2 digits after first ocurance of delimiter -.

Posted: Wed Jan 02, 2008 5:22 am
by Maveric
First do a count(In.Col,"-") and check if it is 2. Then len(field[In.Col,"-", 1) and len(field[In.Col,"-", 2) should be 2 and 3 respectively. And then len(field[In.Col : "-","-",3) should be 4. Probably you can check to see if it is a number or not by using Alpha function. It returns a 1 if it is purely alphabetic. So Alpha(field(In.Col, "-", 1)) <> 1, Alpha(field(In.Col, "-", 2)) <> 1 and Alpha(field(In.Col : "-", "-", 3)) <> 1 should all be true.

Posted: Wed Jan 02, 2008 6:07 am
by shaonli
Thank You for your suggestion.it worked fine.