New feature request
 Crystal Reports Forum : General Information : New feature request
Message Icon Topic: Round numbers to 0 decimal places Post Reply Post New Topic
Author Message
crystalbeg
Newbie
Newbie


Joined: 30 Oct 2012
Online Status: Offline
Posts: 15
Quote crystalbeg Replybullet Topic: Round numbers to 0 decimal places
    Posted: 13 Nov 2012 at 12:16am
Dear all,

I'm trying to round numbers from a formula to 0 decimal places. My formula looks as follows:

Round(Shared Numbervar Execution, 2)

I then placed the formula in a text box (with a % symbol) in my report so that i could display it as a percentage. As a result, right clicking the field to format the field is now out of question (because it lies within a text box).

Your suggestions would be highly appreciated. If you have a more elegant manner of solving the percentage issue as well, i would be very grateful for your suggestion.

regards,
cb
MK
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3663
Quote hilfy Replybullet Posted: 13 Nov 2012 at 7:26am
Actually, you can select the field in a text box, right click, and format it.  However, here's a better way of doing percentages.
 
1.  Put the number field on the report.
2.  Right-click and format.
3.  On the Number tab, click on the Customize button.
4.  On the Number tab, set the number of decimal places.
5.  On the Currency Symbol tab, Enable the currency symbol, Set the Position to the right side of the number, and change "$" to "%".
 
This will give you the percent sign without having to use a text box.
 
-Dell
Proviti, Data & Analytics Practice
9-Time SAP BusinessObjects Partner of the Year.
www.protiviti.com/US-en/data-management-advanced-analytics
IP IP Logged
crystalbeg
Newbie
Newbie


Joined: 30 Oct 2012
Online Status: Offline
Posts: 15
Quote crystalbeg Replybullet Posted: 14 Nov 2012 at 1:17am
It worked! Thank you very much!

Best regards,
Cb
MK
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 06 Dec 2012 at 3:00am
you can always just go trunc(number) and it will remove all the decimals.

or truncate, not sure if CR would require trunc() or truncate()
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3663
Quote hilfy Replybullet Posted: 06 Dec 2012 at 3:46am
In Crystal it's Truncate().  However, truncate does not round, it just strips off the decimal numbers.  So, for example, Truncate(1.99) gives a result of 1.  Formatting the number or using Round() will give a result of 2.  So, you need to think about what result you really want.
 
-Dell
Proviti, Data & Analytics Practice
9-Time SAP BusinessObjects Partner of the Year.
www.protiviti.com/US-en/data-management-advanced-analytics
IP IP Logged
VaniShree
Newbie
Newbie
Avatar

Joined: 07 Feb 2013
Online Status: Offline
Posts: 9
Quote VaniShree Replybullet Posted: 18 Feb 2013 at 2:35am
 Truncate(). and  Round() Works Differently . as per ur question i think u should use  Round().
Vanishree
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.