Re: length function

From: Steve Cosner <stevec_at_csufresno.edu>
Date: Mon, 08 Nov 1999 22:53:31 -0800
Message-ID: <3827C4EB.7281E03C_at_csufresno.edu>


Joet Singh wrote:
>
> Hi All,
> I am trying to do a check to make sure that when a person fills out a phone
> number field that the it contains correct number of digits. I have a check
> to do this but it keeps running into a problem. The check is in the form of
> a if statement:
> If length(home_area)=3 and length(home_three)=3 and length(home_four)=4 then
> *do Something*
> else *Do something*
> Now if the value being inserted in the home_area field is 123 this is ok
> then length of this string is 3 but is the value is 012 the length of this
> string is 2. Now how do I tell the program that the string is really 3
> digits long and the "0" value is not a null value? Any ideas? Thanks in
> advance

It sounds like the leading zero is being ignored. Have you made the fields numeric? You should NOT do that. It leads to problems like this. Numeric fields should ONLY be used for fields with actual numbers that you can use for calculations.

Change the data type to character, and loop through the field, checking each character making sure it is between 0 and 9.

Steve Cosner Received on Tue Nov 09 1999 - 07:53:31 CET

Original text of this message