I had this requirement where I wanted to show a decimal number with 2 decimal points in my report but when there is no decimal value I wanted to show the integer part only i.e.
I wanted to show
50
instead of
50.00 (default behavior)
I had to define a custom formula for this
here is the procedure
if CurrentFieldValue - truncate(CurrentFieldValue) <> 0 then
2
else
0
This basically means that if the current value has no decimals show 0 or no decimal places , else show 2.
Thanks to an answer in below stackoverflow thread from where I got to know about "CurrentFieldValue "
http://stackoverflow.com/questions/17284732/how-to-ignore-zero-decimal-place-values-in-crystal-reports
I wanted to show
50
instead of
50.00 (default behavior)
I had to define a custom formula for this
here is the procedure
- right click on your field in crystal report
- Format field
- Click on Number tab
- Press customize button
- Define a formula for Decimals as below
if CurrentFieldValue - truncate(CurrentFieldValue) <> 0 then
2
else
0
This basically means that if the current value has no decimals show 0 or no decimal places , else show 2.
Thanks to an answer in below stackoverflow thread from where I got to know about "CurrentFieldValue "
http://stackoverflow.com/questions/17284732/how-to-ignore-zero-decimal-place-values-in-crystal-reports
No comments:
Post a Comment