Hawaii80 Posted April 19, 2008 Share Posted April 19, 2008 I have FM9 Pro Advanced and created a custom phone function, but for some reason can't get it to work in my phone field, nothing happens when I enter 9 digits. I did an autocalc as text for the function I created on the "home phone" field and the auto calc is as such... FormatPhone ("home Phone" ; "usa_standard") Now, here's the actual code for the custom FormatPhone function: Let ([ minimumDigits = 10; digitsOnly = Filter ( text; "0123456789" ); digitCount = Length ( digitsOnly ); errorCheck = Case ( digitCount fnTextColor ( "error - too few numerals: " & text; "red" ); 0 ); styleMask = Case ( style = "usa_standard" ; "(***) ***-****"; style = "usa_dot" ; "***.***.****"; style = "japan_alternate" ; "* ** ***-****"; style = "japan_standard" ; "** ****-****"; "*** ***-****" ); mask = styleMask & Case (digitCount > minimumDigits ; " x**********"); formatText = fnMaskReplace ( mask; digitsOnly; "*" ); finalBlackText = fnTextColor ( formatText; "black" ) ]; Case ( errorCheck 0; errorCheck; finalBlackText ) ) Can't figure out where I'm having a problem, any help is very much appreciated. Link to comment Share on other sites More sharing options...
Hawaii80 Posted April 19, 2008 Author Share Posted April 19, 2008 Also should note the parameters that I created in the custom function in order are: text style Link to comment Share on other sites More sharing options...
Hawaii80 Posted April 20, 2008 Author Share Posted April 20, 2008 Never mind, I figured it out. The problem was the order of function parameters in the 2 dependent custom functions I have; maskreplace and textcolor. For example in the custom textcolor function, the parameters are text and color and I had the order wrong in that it should have been color first then text. Once I changed the order the phone number is formatting correctly. Link to comment Share on other sites More sharing options...
Recommended Posts