Domino Code Fragment

Code Name*
Format Phone Number Fields
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.129.70.157
Description*
This formula will automatically format phone number field entries in which the user does not enter dashes between the area code, prefix and suffix. For example, if a user types 4077888561, Notes will convert the number to 407-788-8561. This formula is ideal if you are importing information from another database in which phone number formatting was not used, or you just want to assist your users in properly formatting a phone number. This is just an example used to illustrate the use of formulas to format text: your formula may take on some additional characteristics depending on the phone number lengths, formatting needs, etc. that are typically entered by the user in an "ideal world" situation.
Type*
Formula
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
PhoneNbr := CustomerPhone1;
FIELD CustomerPhone1 := CustomerPhone1;
Len := @Length(PhoneNbr);
newPhone := @If(Len = 7 ;
@Left(PhoneNbr ; 3) + "-" + @Right(PhoneNbr ; 4);
len = 10;
"(" + @Left(PhoneNbr ; 3) + ") " + @Middle(PhoneNbr ; 3 ; 3 ) + "-" +
@Right(PhoneNbr ; 4) ;
PhoneNbr) ;
newPhone