CONTACT US Phone: (412) 835-9417 Email: sales@vss3.com |
Tip # 23 - Phone Edits
It is often the case that an edit that we use all the time like the phone edit, which changes the phone number to a nice view needs some modifications.
phone: \ <"(" N N N <")"> <" "> N N N <"-"> N N N N | N N N <"-"> N N N N
This edit will accept a 10 or 7 digit phone number, add the parenthesis, dashes and spaces and right justify the result. A list of phone numbers entered with this edit would look like this:
(412) 555-1212
512-1212
Now it sometimes happens that for certain purposes the phone number must be converted to just numbers. For that purpose another edit comes in handy.
UNPHONE: { !"("! | !")"! | !"-"! | !" "! | * }
This edit will eliminate the characters we do not want and leave all the numbers. The wildcard (*) will allow for any other characters to be accepted. To apply this edit you can take a field number that had a phone number such as 5 and use the new command DOEDIT.
dy=doedit(5,"unphone")
Now dy had the result of the change from the phone edit to the unphone edit.
4125551212
5121212
Our two phone numbers would be changed as shown.
Written by Nancy Palmquist
Copyright, 1997 by Virtual Software Systems. All rights reserved.