Jump to content

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

Recommended Posts

Hello

I'm using FMSP 4.5 on Mac OSX FMP Adv 14.0

I want to get rid of phone formatting, too many countries too many formats and it is inserting x everywhere.

What I've done :

1- went to Custom Functions and placed a remar on every line of the function fnPhone(text) and IT DID NOT WORK!
Why?

What is the correct procedure to just leave the phone as typed with no special formatting?

I can find every single phone field and remove the function from there but replacing the function would keep the nice work for a rainy day...

 

Cheers

 

Beto Boton

 

// fnPhone(text)
// depending on phone # length, will format accordingly
// Timothy Trimble, www.timothytrimble.info


//  REMOVED FORMATTTIN FROM PHONE FIELDS

// Let (pnum = Substitute( text; [ " "; "" ]; [ "("; ""]; [ ")"; ""]; [ "-"; ""]; [ "."; ""]; [ "x"; ""] ) ;
// Case (Length(pnum) = 7 ; Left(pnum;3) & "-" & Right(pnum;4) ;
//    Length(pnum) = 10 ; "(" & Left(pnum;3) & ")" & Middle(pnum; 4;3) & "-" & Right(pnum;4) ;
//    (Length(pnum) = 11 and Left(pnum;1) = "1") ; "1+(" & Middle(pnum;2;3) & ")" & Middle(pnum;5;3) & "-" & Right(pnum;4) ;
//    (Length(pnum) > 11 and Left(pnum;1) = "1") ; "1+(" & Middle(pnum;2;3) & ")" & Middle(pnum;5;3) & "-" & Middle(pnum;8;4) & " x" & Right(pnum;(Length(pnum)-11)) ;
//    Length(pnum) > 10; "(" & Left(pnum;3) & ")" & Middle(pnum;4;3) & "-" & Middle(pnum;7;4) & " x" & Right(pnum;(Length(pnum)-10)) ;
//   pnum ) 
// )

Link to comment
Share on other sites

OK I'll leave the question here so some other "novice" like me can find the answer searching for Phone formatting

The answer is that a custom function has written the LEFT side of the equation 
fnPhone (text) = 

this is located on top of where you write the code ! 

The solution was to just write text and the result would be:

fnPhone (text) = text

Like this:

//This is a CUSTOM FUNCTION -> Manage -> Custom function -> fnPhone(text)
// fnPhone(text)
// depending on phone # length, will format accordingly
// Timothy Trimble, www.timothytrimble.info


//  REMOVED FORMATTTING FROM PHONE FIELDS

// Let (pnum = Substitute( text; [ " "; "" ]; [ "("; ""]; [ ")"; ""]; [ "-"; ""]; [ "."; ""]; [ "x"; ""] ) ;
// Case (Length(pnum) = 7 ; Left(pnum;3) & "-" & Right(pnum;4) ;
//    Length(pnum) = 10 ; "(" & Left(pnum;3) & ")" & Middle(pnum; 4;3) & "-" & Right(pnum;4) ;
//    (Length(pnum) = 11 and Left(pnum;1) = "1") ; "1+(" & Middle(pnum;2;3) & ")" & Middle(pnum;5;3) & "-" & Right(pnum;4) ;
//    (Length(pnum) > 11 and Left(pnum;1) = "1") ; "1+(" & Middle(pnum;2;3) & ")" & Middle(pnum;5;3) & "-" & Middle(pnum;8;4) & " x" & Right(pnum;(Length(pnum)-11)) ;
//    Length(pnum) > 10; "(" & Left(pnum;3) & ")" & Middle(pnum;4;3) & "-" & Middle(pnum;7;4) & " x" & Right(pnum;(Length(pnum)-10)) ;
//   pnum ) 
// )


text

========

wow, what a learning curve...

 

Beto Boton

Australia

Link to comment
Share on other sites

This topic is 3109 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.