6 Replies Latest reply on Oct 26, 2012 10:08 PM by jimb6451

    Phone Number Format

    samjs

      I have a field with phone numbers in the following format:

       

      000-000-0000

      000-0000

       

      I need to remove the "-" so there are just digits in the field.

       

      How do I go about doing that?

       

      Thanks for your help!

       

      Sam

        • 1. Re: Phone Number Format
          MattLeach

          Use the substitute function:

          Substitute ( phonenumberfield ; "-" ; "" )

          • 2. Re: Phone Number Format
            beverly

            That just removes the "-". If you just want DIGITS, use Filter() function:

             

            Filter ( phoneNum ; "1234567890" )

             

            -- sent from my iPhone4 --

            Beverly Voth

            --

            • 3. Re: Phone Number Format
              samjs

              That worked!  Thanks,

               

              Sam

              • 4. Re: Phone Number Format
                jimb6451

                After several attempts I received help in formating phone numbers regardless of how they were typed. Using the Auto-Enter Calculated value option feature and unchecking "Do not replace existing value of field (if any). I also modified the solution to allow entering 3 digit extensions.

                Let (

                         [ num = Filter ( Self ;"0123456789" );

                           num = Case(Left(num;1)= "1"; Middle(num;2;20); num);  // remove 'Dial 1' if it's there

                             len = Length(num) ];

                 

                Case( len = 10; TextColor("(" & Left( num; 3) & ") " & Middle( num; 4; 3) & "-" & Middle( num ;7;4); RGB(0;0;0)); // with area code

                           len = 7;  TextColor( Left( num; 3) & "-" & Middle( num;4;4); RGB(0;0;0)); // without area code

                          len = 3; TextColor("Ext - " & num; RGB(0;0;0) ) ) // extensions;

                )

                • 5. Re: Phone Number Format
                  samjs

                  I incorporated your filter, however when my phone number starts with the number 1, the number will not appear.  Have you had that problem?  I am using the latest version of Filemaker 12 that was just released this week...12.0v3.  This is an odd error.

                  • 6. Re: Phone Number Format
                    jimb6451

                    Removalof the 1 is by design in the fomula. Cell phones don't need a 1 to dial long distance. If you need the 1 you will need to remove the line after Filter and fix/add the following lines to deal with the longer number.