Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do nested "replace" statements 2

Status
Not open for further replies.

zencalc

IS-IT--Management
Feb 27, 2002
67
US
I have a phone number field in a report that is a jumble of numbers and/or spaces/ and or dashes, ("-" or " "). My formula to get rid of these characters was

if "-" in {EnrCommunicationInfo.CommValue} then Replace ({EnrCommunicationInfo.CommValue},"-" ,"") else
if " " in {EnrCommunicationInfo.CommValue} then Replace ({EnrCommunicationInfo.CommValue}," " ,"") else
{EnrCommunicationInfo.CommValue}

but I noticed that it only does one or the other of the operations. But I have a couple of records that have format XXX XXX-XXXX, so it only gets rid of one of them. How do I nest these statements so that it will take care of both of them? thanks in advance.
Brian
 
Try:

Replace(Replace({EnrCommunicationInfo.CommValue}," " ,""),"-","")

You don't need any IFs.

-k
 
OH YEAH!!!
Thanks, bro... works like a charm.
(Rack him.)
Brian
 
Local StringVar new_phone;
new_phone := Replace ({Customer.Phone},"-" ,"" );
new_phone := Replace (new_phone," " ,"" );

HTH



Bob Suruncle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top