It can be modifed for any other format you wish.
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);