September 12, 200223 yr 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.
September 12, 200223 yr 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.
September 14, 200223 yr Found the following calc to be quite useful from JMO: Involves two fields: (a) Phone Number ( 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.
September 14, 200223 yr 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.) 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 )
Create an account or sign in to comment