Print Page | Close Window

Round numbers to 0 decimal places

Printed From: Crystal Reports Book
Category: General Information
Forum Name: New feature request
Forum Discription: Share what features you want to see in the next release of Crystal Reports.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17997
Printed Date: 24 Apr 2024 at 11:15pm


Topic: Round numbers to 0 decimal places
Posted By: crystalbeg
Subject: Round numbers to 0 decimal places
Date 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



Replies:
Posted By: hilfy
Date 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
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: crystalbeg
Date Posted: 14 Nov 2012 at 1:17am
It worked! Thank you very much!

Best regards,
Cb


-------------
MK


Posted By: comatt1
Date 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()


Posted By: hilfy
Date 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
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: VaniShree
Date Posted: 18 Feb 2013 at 2:35am
 Truncate(). and  Round() Works Differently . as per ur question i think u should use  Round().

-------------
Vanishree



Print Page | Close Window