Standardize The Display Of Phone Numbers

Add this tip to a validation field for a phone number or fax number. It will
standardize the display of the phone number.
@If(Phone="";@Return("");"");
tPhone0 := @ReplaceSubstring (Phone; "("; "");
tPhone2 := @ReplaceSubstring (tPhone0; ")"; "");
tPhone3 := @ReplaceSubstring (tPhone2; "-"; "");
tPhone4 := @ReplaceSubstring (tPhone3; "/"; "");
tPhone5 := @ReplaceSubstring (tPhone4; " "; "");
tPhone6 := @ReplaceSubstring (tPhone5; "_"; "");
tPhone7 := @ReplaceSubstring (tPhone6; "="; "");
tLengthPhone := @Length (tPhone7);
tPhone8:= @If(tLengthPhone > 10 ; @Right (tPhone7; 10); tPhone7);
tNoFrillPhone := @Trim(tPhone8);
REM "Set default area code if none entered to 714";
tArea := @If(tLengthPhone = 7;"714";@Left(tNoFrillPhone;3));
tOther := @If(tLengthPhone = 7;tNoFrillPhone;@Right(tNoFrillPhone; tArea));
tPre := @Left(tOther; 3);
tSuffix := @Right(tOther;4);
tPhoneLen := (tLengthPhone -10);
tDialPre := @If(tLengthPhone > 10; @Left(tPhone7;tPhoneLen); "");
@If(tLengthPhone>10; Phone; tDialPre + "(" + tArea + ") " + tPre + "-" +
tSuffix)
This was last published in November 2000

Dig Deeper on Lotus Notes Domino Formula Language

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close