8 Replies Latest reply on Dec 15, 2011 3:50 PM by BarryMillenson

    Help with a phone number field

    BarryMillenson

      Title

      Help with a phone number field

      Post

       I have created a data base and I have a field set up for phone number.   How do I set the field so that if I enter 7135428288 it will display it as 713-542-8288 or (713)542-8288.

      Thanks if you can help me.

       

      Barry

       

        • 1. Re: Help with a phone number field
          philmodjunk

          Do you want to keep the value entered as pure numeric digits or could an auto-enter calculation provide the formatting after you exit the field?

          This calculation will provide the formatting:

          Let ( n = Filter ( Self ; 98765543210 ) ; "(" & Left ( n ; 3 ) & ")" & Middle ( n , 4, 3 ) & "-" Right ( n ; 4 ) )

          Put this in an auto-entered calculation with "do not replace existing values..." cleared and you'll see the formatting added when you exit the field. A more sophisticated version of this calculation can check the number of digits entered and add a default area code if desired.

          Put the same expression in a calculation field, but with the name of your field in place of "self" and you get one field for data entry where you just enter the digits and a second calculation field for displaying the formatted phone number.

          • 2. Re: Help with a phone number field
            BarryMillenson

            PhilModJunk,

            Thanks for your response, I tried to enter what you put but I am still getting an error.

            Is there not a built in Field Format that would format the number automatically as a Phone Number?

            Barry

             

             

            • 3. Re: Help with a phone number field
              philmodjunk

              What exactly did you enter and in one kind of field? I described two different approaches so I need to know what you tried.

              There is no built in phone number format.

              • 4. Re: Help with a phone number field
                BarryMillenson

                 Ok, I went into Manage Database and I clicked on the field that I have called "Home Phone".  When I double click on the field another box opens that says Options for Field "Home Phone".

                Toward the bottom of the box there is a line that says Calculate  next to it is Specify.  so I clicked specify and another box opens that says specify calculation.  I then entered what you sent me

                Let ( n = Filter ( Self ; 98765543210 ) ; "(" & Left ( n ; 3 ) & ")" & Middle ( n , 4, 3 ) & "-" Right ( n ; 4 ) )

                I changed the word Self to Home Phone so it looked like this

                Let ( n = Filter ( Home Phone ;) ; "(" & Left ( n ; 3 ) & ")" & Middle ( n , 4, 3 ) & "-" Right ( n ; 4 ) )

                That's when I get an error and something is wrong.

                Thanks,

                Barry

                • 5. Re: Help with a phone number field
                  philmodjunk

                  You should be able to use self instead of the field name.

                  What does the error message report? Is any part of the expression highlighted?

                  • 6. Re: Help with a phone number field
                    BarryMillenson

                    When I enter exactly what you put

                    Let ( n = Filter ( Self ; 98765543210 ) ; "(" & Left ( n ; 3 ) & ")" & Middle ( n , 4, 3 ) & "-" Right ( n ; 4 ) )

                     and try to save it the word Right is highlited in blue and the pop up box says

                    An operator (e.g. +, -,*, ...) is expected here.

                    • 7. Re: Help with a phone number field
                      philmodjunk

                      Aha! there's a typo in my example. A & was left out.

                      Use:

                      Let ( n = Filter ( Self ; 98765543210 ) ; "(" & Left ( n ; 3 ) & ")" & Middle ( n , 4, 3 ) & "-" & Right ( n ; 4 ) )

                      • 8. Re: Help with a phone number field
                        BarryMillenson

                        Thank you, Thank you, Thank you!!!!

                        It worked.

                        Again,  thanks for your help.