Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: displaying decimals Post Reply Post New Topic
Author Message
kirandb
Groupie
Groupie
Avatar

Joined: 10 Jun 2009
Location: United States
Online Status: Offline
Posts: 69
Quote kirandb Replybullet Topic: displaying decimals
     Posted: 11 May 2011 at 3:26am
i am using a stored proc in my report template. I have to display decimals values as it is fetched from the stored proc. I tried setting the customizing the number format with decimals as 1.0000000 and rounding as 0.00000001 and negatives as -1234.
The issue is if the value is 0.5, it displays 0.5000000.
I want to display as is fetched from the stored proc . The value can be 0.5, 0.4567   or  0.5647576573. My number of decimals keep changing based on the calculation. How do i achieve this by customizing the field.
 
Thanks,
Kiran
share your knowledge
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 12 May 2011 at 3:38am
don't display them as numbers, display them as text:
toText({table.field}, 0,"")
 
you can still do whatever math is needed, as the field values are numbers, you are just telling the report to display the field as a string.
 
HTH
IP IP Logged
kirandb
Groupie
Groupie
Avatar

Joined: 10 Jun 2009
Location: United States
Online Status: Offline
Posts: 69
Quote kirandb Replybullet Posted: 12 May 2011 at 4:11am

I can still use the existing format to display values upto 8 decimals. But my concern is if i select that, i still get 8 values after the decimal even though.

i.e., if my value is 0.5, it displays 0.50000000 . i dont want to display any trailing zeros. Even if i convert it to text, still it dispays 8 decimals.
 
I used  
toText({table.field}, 8,"#.########")
 
I was wondering there is a way to display the values as calculated by the SQL itself. say a 1/3 values should display the value until it reaches the width of the control.
 
Thanks,
kiran
 
share your knowledge
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 13 May 2011 at 11:16am
if I read the help file correctly, you are telling it to convert to 8 decimal places, which you said you don't want.
 
I would have thought that the formatting string would have suppressed the 0's but again looking at the help file, it is not the correct pattern, if I read it right, it should be:
toText({table.field},"#.######")  the rest are optional, and don't really apply.
 
HTH
 
 
IP IP Logged
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