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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace text 1

Status
Not open for further replies.

needmoremoney

Technical User
Mar 30, 2005
123
US
I have a phone number field (000)234-0000.
If there is no phone number then the output is ( ) -

Does anyone know how to write a formula to replace the "( ) - " with just a blank spot?

Thanks much.

My current formula is:

whileprintingrecords;
if not isnull ({EInfo.homePhone}) then {EInfo.homePhone} else "";

But this doesn't work. The "( ) - " still shows.

cystal reports 8.5

 
That's odd. Maybe try:

if {EInfo.homePhone} = "( ) - " then "" else
{EInfo.homePhone}

-LB
 
Hi,
If there is no phone number, where is the ( ) - coming from?


If it is in the data field, then the IsNull test will never be true..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks LB, but the same thing still shows. I think the field format was set to have the ( ) - .

Any other ideas let me know.

Thanks much..
 
Perhaps you could try this:

if trim(mid({EInfo.homePhone},2,3))=""
then ""
else {EInfo.homePhone}

~Brian
 
Brian,

Thanks much. That's perfect. I gave you a star.. I just figured out how the star stuff worked here.

Thanks much.
 
Hi,
OK, Try avoiding using the actual field altogether:
Code:
@DoPhone
numberVar indx;
numberVar Lngth;
stringVar StrOut := "" ;
If {EInfo.homePhone}[2] not in ['0','1','2','3','4','5','6','7','8','9']
then
''
else

for indx := 1 to  Length(EInfo.homePhone})do
 (StrOut := StrOut + {EInfo.homePhone}[indx]);
StrOut

Assumes valid Phone numbers always have a number in the second spot ...

Use the formula and not the field for display..



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
I need to type faster..Nice answer Brian..


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top