Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Created Custom Phone Function but problem...


Hawaii80

Recommended Posts

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

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



×
×
  • Create New...

Important Information

Terms of Use