Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formatting number Post Reply Post New Topic
Author Message
Davida
Newbie
Newbie
Avatar

Joined: 29 Jul 2009
Location: United States
Online Status: Offline
Posts: 1
Quote Davida Replybullet Topic: Formatting number
    Posted: 29 Jul 2009 at 2:13pm
I am trying to format the number in a field so that it will have no more than 2 decimal places, but fewer if appropriate.  In other words, I want it to display data as 4 or 4.5 or 4.25, but not 4.00 or 4.50.  I'm using CR 2008.  Can you help me with this?

Edited by Davida - 29 Jul 2009 at 2:14pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Jul 2009 at 3:06pm
There is probably a more elegant solution but try this:
Right click on the field and select Format Field.
Select the Number tab
click on Customize
UNder the Number Tab add a formula to the Decimals as:
if right(totext({table.numberfield},2),2)="00" then 0 else
if right(totext({table.numberfield},2),1)="0" then 1 else 2
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.