Reputation: 1
I wonder if you might be able to help me with a technical challenge that I have come across in Crystal Reports.
We are currently saving a number into the Database using a Float data type. The number being saved into the DB can be any of the following types of numbers:
When I query the DB, it gives me back the exact value as it has been entered. The challenge is when we come to display it in Crystal Reports. Crystal seems to wish in its default mode to truncate / round the value.
I have looked at moving it to Text, formatting the value with Decimal points. Formatting with Decimal points handled the numbers which had large numbers of decimal points in them, however it also applied this formatting to values which were Integers.
For example, with decimal place formatting it converts a “23” into being “23.0000” which is undesirable for the client. Essentially, I am looking for a solution which will display exactly what is in the database with no truncating / rounding / adding additional decimal zero’s to the number when it is displayed in Crystal Reports.
Any advice would be appreciated.
Thank you
Rick
Upvotes: 0
Views: 752
Reputation: 4026
Right-click your number field, select Format Field, Number Tab, Customize...
Set Rounding to have enough decimals to show up to 10 decimals.
Set the following expression for the Decimals property:
local stringvar DecimalsAsString := Split(ToText(CurrentFieldValue, 10), ".")[2];
Len(ToText(Val(StrReverse(DecimalsAsString)),0,""));
Upvotes: 0