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

Alternative to Replace?

Status
Not open for further replies.

cafenerogal

Technical User
Mar 23, 2004
12
GB
Hi!

My collegue is trying to remove a ',' from the output of the following:

if {EComp.EmAnnual} < 10.00 then
'000000' +
(totext({EComp.EmAnnual})) + '0'

where {EComp.EmAnnual} is a number field and the ',' is thousand separator. He's using Crystal 7, and says that the following doesn't work

if {EComp.EmAnnual} < 10.00 then
'000000' +
replace((totext({EComp.EmAnnual})), ',', '') + '0'

which I know does work in later versions of Crystal. Since I don't have access to Crystal at the moment, I'm kinda stuck as to how to help him.

Any help, is appreciated.
Thanks in advance
Hetal
 
He should be able to get rid of the thousands seperator through the ToText function like this:

if {EComp.EmAnnual} < 10.00 then
'000000' +
(totext({EComp.EmAnnual}),0,"") + '0'

~Brian
 
Why not just format the number field to not have a thousands separator? No formula necessary.

"making predictions is tough, especially about the future" - Yogi Berra


Software Sales, Training, Implementation and Support for Macola, eSynergy, and Crystal Reports
 
Cheers Brian, wasn't quite what was needed, but got me on the right track!

dgillz, I suggested that initially to my colleague, and since he had already converted the number to text, it seemed easier to get rid of the thousand separator afterwards.

As it turns out, I had to do the 2 hour drive up to his office, and sort the report out myself. And no, they won't be giving me access to either Crystal or the database #-)

Thanks again for your help
Hetal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top