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

Trimming the Dollar Sign in Transform 4

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

bb_imh55y.jpg


How would I remove all the spaces between the $ and number after being transformed? One or two spaces is preferred. I need to reclaim the space as this field is taking up too much space on a report and other places. And, it's not an issue when using large numbers as the spaces gets filled up with numbers.

I know that I can count the chars in the value and use a case statement to build a matching transform, but I'm hoping for something more generic.

Thanks,
Stanley
 
Reduce() of Foxtools.fll does that-

Code:
Set Library To Foxtools.fll additive
Clear
ab = 123.45
? Reduce(Transform(ab,'$999,999,999.99'))

And an even simpler solution is to let Transform act without your help, just adjust the number of decimal places with SET DECIMALS TO 2 and use
Code:
Set Decimals To 2
Clear
ab = Cast(1234.56 as Currency)
? Transform(ab)
That prints the value with currency symbol and 1000s separator because it's the type currency.

Chriss
 
Thanks Chris, exactly what I needed...
Stanley
 
A simpler solution is to put two (or more) dollar signs at the front of the mask in TRANSFORM():

Code:
Transform(ab,'$$999,999,999.99')

Tamar
 
Hi,

Unfortunately it only works with the $ sign - $€ or $£ or any other combination of $x is not working. You may of course use @$ to show the local currency.

Code:
y = 250

SET CURRENCY RIGHT 
?TRANSFORM(y, "@$999,999")
SET CURRENCY LEFT
?TRANSFORM(y, "@$999,999")

hth

MarK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top