cdbl in crystal reports is giving wrong results in decimal points - crystal-reports

Friends,
This is the formula in the crystal reports 9.
cdbl({nrconsolidated.collamt})/100000.000
nrconsolidated table is having 9 records.
in that one record's collamt value is 154250.
but in the crystal reports output its showing as 1.543 instead of 1.542.
i want only 3 decimal points.i dont know where the mistake is coming from?
in the crystal reports, i clicked on that collamt field and checked the data by seeing the browseData option...its showing as 154250.
how can i solve this issue? its showing the correct value in 4 decimal points but i want only 3 decimal points.
thanks

The below code will truncate the result after the calculation has been performed, and output it to 3 decimal places. This works for Crystal Syntax and should for Basic as well - I believe it is common amongst both.
truncate(cdbl({nrconsolidated.collamt})/100000.000,3)
On the field set the decimals 1.000 and rounding 0.001 will display what you want.

Related

How to round field in SAP Crystal Report 2011?

Rounding of static value is different from rounding DB field value in SAP B1 crystal report 2011
I have 609,437.50 from Database when I go to Field Format and then round field I get 609,437
I have 609,437.50 in formula as static value when I round I get 609,438 which is correct same as excel
How can I round Database field and get value like 609,438 while I have 609,437.50?
Please anyone can help me
You likely have database value different from xxx.50.
What data type is your value in database - some float or decimal or money?
If float, then you have to convert it to decimal first - float values are inexact and rounding may behave strangely.
If decimal or money, then you may have more decimal places filled (like xxx.499), which rounds down again. You need either accept your results or round to two decimals first; this can be visually better, but is wrong mathematically.

How to remove 2 decimal places without rounding in a running total in CR?

I have a number field in my database that contains four decimal places. I have a running total in my Crystal Report that sums this field. I am attempting to not round and only show 2 decimal places.
Example:
My running total displays 809.47
I want it to show 809.46
Since the field from the database produces a sum of 809.4680, how can I just make it 809.46?
Any assistance would be greatly appreciated - thanks!

Decimals are being rounded in crystal reports and computing incorrectly

Decimals are being rounded in crystal reports. The field(database field defined as float) Hours is being wrongly displayed in the crystal report. For example, 1.5 in the db is showing as 2.00, .75 shows as 1.00 and so on. There is also a field used to sum all the hours. That field is also picking the rounded values and summing incorrectly. I have formatted Hours as 1.00 and .01 in the formatting of crystal reports(for rounding & decimals). I also have the common tab(in format editor) as LN_Hours. Nothing seems to be working. I tried using x-2 formula with no luck.
Using crystal reports XI and SQL server MS 2012 and Visual studio 2003. Please throw some light on this situation! Thanks!
After a lot of trial and error , finally figured it out! The float from the database was being converted to decimal and being shown on the crystal report. Someone forgot to define the decimal places! Its all fixed up and running as expected. Thanks for all your suggestions.
In Crystal report
1. "Right Click" on the field and go to Format Field
2. In Format Editor go to Number Tab and then select from the different available decimal formats.
It may be rounding because of rounding decimal places

display specific number of significant figures rather than decimal places in crystal reports 2008

Good Morning!
I am working in Crystal Reports 2008 & have a report template that I'd like to use with various dynamic parameters (called in a downstream application).
My data can vary from being on a scale of 0-1 to a scale of 1,000-10,000.
I'd like to display it with 3 significant figures so when the report pulls in a dataset that
looks like this --> displays like this
0.76895 --> 0.769
0.6672 --> 0.667
1.0335 --> 1.03
but when the data set
looks like this --> displays like this
12,125.65 --> 12,100
956.35 --> 956
4,352.22 --> 4,350
My current work around is to make two templates-- one to use with my small value data, set to display 3 decimal places; and another to use with my large value data, set to display no decimal places.
I was wondering if there was a way to set significant figures displayed rather than decimal points?
Oh! I would do it in SQL first and pass it in as a string but I need these as numeric values so I can summarize them elsewhere in the report. Thanks.
If you right-click on your numeric field and choose format, Customize..under the number tab you get a bunch of choices to set the decimal separator, how many decimals to display, etc. choosing the formula button next to Decimals, you could put in a formula that looks at the amount of digits after the decimal dot and then either set the decimals to 2 if there are more than 3 decimals, and to zero decimals if there are 2 decimals. They key here is to get the order right. You want to check for the 2 decimals first and then for 3 or more decimals. If you do it the other way around the formula will display everything without decimals.
Hope that helps,
Chris
Use something like this.
ToNumber(Totext(<<DatabaseField>>,0,""))

Display CR values as scientific notation

I have a series of very small positive and negative values stored in oracle which I am attempting to display in crystal reports. Crystal is displaying all the values as 0. However if I turn the max decimal places on I will see some values as 0.00...00XY.
I would like these values simply displayed as scientific notation with something like 1.2E-12.
It seems crystal automatically converts very large values to SN, but not very small values?
This is not possible so I went and created a view instead for each needed table. Kind of a dumb solution, but it seems the only way possible.