Jump to content

This topic is 8176 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am creating some fields like phone number.

Here is what I have phone1 , phone2, phone3.

The calc is phone1 & -phone2 & -phone3

if one of the numbers begin with a 0 it elimates its.

Example:

fiedls 800-XXX-0XXX

Views 800-XXX-XXX

How can I get around it?

All fields are number fields. I tried text fields with same results.

Posted

First of all 800-123-4567 is NOT a valid number and must be stored as text. Filemaker stripping the leading 0 out of the data would be the expected result, although since this is an invalid number in the first place.

Second, I cannot think of any concievable situation where Filemaker will strip a 0 out of a text field. Assuming that you simply switched the field back and forth between text and number, the 0 will never be restored, as it was never stored in the first place.

Set the field as text and re-enter the correct phone numbers.

Posted

Found the following calc to be quite useful from JMO:

Involves two fields: (a) Phone Number (B) Phone Filter

Field (: is transparent and overlayed field (a). No entry allowed on field (: also take out of tab order.

"(" & Left(Abs(TextToNum(Phone Number)),3) & ") "

& Middle(Abs(TextToNum(Phone Number)),4,3) &

"-" & Right(Abs(TextToNum(Phone Number)),4)

Users type 8001234567 and (800) 123-4567 is displayed. Will always display leading zeros.

Posted

Here's the calc I use for formatting telephone numbers from text fields. Although a bit longer than other examples, it works reliably and under different conditions (no area code, 1 + Area Code, etc.)B)

Case(Length(LeftWords(Substitute(FieldName, "-", ""), 1)) = 11,

Left(Substitute(FieldName, "-", ""), 1) & "-" & Middle(Substitute(FieldName, "-", ""), 2, 3) & "-" & Middle(Substitute(FieldName, "-", ""), 5, 3) & "-" & Middle(Substitute(FieldName, "-", ""), 8, 4) & Right(FieldName, Length(Substitute(FieldName, "-", "")) - 11),

Length(LeftWords(Substitute(FieldName, "-", ""), 1)) = 10,

Left(Substitute(FieldName, "-", ""), 3) & "-" & Middle(Substitute(FieldName, "-", ""), 4, 3) & "-" & Middle(Substitute(FieldName, "-", ""), 7, 4) & Right(FieldName, Length(Substitute(FieldName, "-", "")) - 10),

Length(LeftWords(Substitute(FieldName, "-", ""), 1)) = 7,

Left(Substitute(FieldName, "-", ""), 3) & "-" & Middle(Substitute(FieldName, "-", ""), 4, 4) & Right(FieldName, Length(Substitute(FieldName, "-", "")) - 7)

,

FieldName

)

This topic is 8176 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.