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!

Decimal Problem

Status
Not open for further replies.

KH75

Programmer
Jun 1, 2010
42
CA
Hi

In crystal it shows

10.25
25.65
100.00
3500.00


I have data like this

totAmount

10.25
25.65
100
3500

I want it same like above

Thanks in advance

using crystal XI
 
One possible solution, does not account for negative numbers
if {totAmount} >1 then
if {totAmount}/truncate({totAmount}) = 1 then totext({totAmount},0)
else totext({totAmount})
else
totext({totAmount})
 
Hi

Thanks for reply

It removes all decimal but I want to remove only .00

2565.00 is shows like 2565
2565.65 is shows like 2565.65

Thanks in advance

Bye
 
Strange when I did my test, it worked properly. But then again, the only 'decimal' numbers I have available SQL currency fields.
 
see if this works for you...it seems wrong to me but gave me good results on a small test sample.

a little modification....change the divide to subtract, instead of =1, now is <>0, and explicitly defined the # of decimals for each instance.


if {totAmount} >1 then
if {totAmount} - truncate({totAmount}) <> 0 then totext({totAmount},2)
else totext({totAmount},0)
else
totext({totAmount},2)
 
Hi


It works great, I remove if condition for negative value


Thanks

 
kray,
LOL don't we all!
if the headache would go away my day would be SO much improved!
 
Or you could use:

if int({table.amt}) = {table.amt} then
totext({table.amt},0,"") else
totext({table.amt},2,"")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top