Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop Crystal Rounding up numbers 1

Status
Not open for further replies.

jehanzebn

Programmer
May 28, 2001
244
Morning All,

I have a query about Crystal reports rounding up function.

How can you stop crystal from rounding up numbers, for example, I have a number in database with 8012115284696055, when shown in crystal it is shown as 8012115284696060.

Note the last 2 digits in the 2nd number, it is gone from 55 to 60.

How can you stop crystal rounding up the figures?

Please advise.

Many thanks

Regards

Jehanzeb
 
Right-click and chose 'Format Field', you should find controls there for rounding.

You can also display using ToText, and can define the amount of rounding, e.g.
Code:
ToText({your.number}, 0)
It always helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hello and thanks for your quick reply, the field is actually an Int, so it is already ,0 (not a decimal field value).

Any other ideas?

Regards

Jehanzeb
 
It may be too big, sixteen digit. I've no experience with numbers as large as that. Does anyone else know?

Did you try converting to text?

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Hello, I think I have found a solution.

Here I have taken it from another forum

"
The fix there was to actually convert the number to a string (VARCHAR) within the database, so the value that CR got was a string, instead of a number. That may or may not be an option for you, depending on your circumstances.

If you simply want to show the value on a report, you could try creating a formula like the following:

+CStr ({table.field} / 100000, "#") ++
CStr (Round ({table.field} - (Truncate ({table.field} / 100000) * 100000)), "00000")

Make the formula name whatever you want. Replace every {table.field} with your field name and put that formula on the report. The formula just tries to split the number into two pieces, convert each piece to a string and concatenate them back together. No guarantees!"


Regards

Jehanzeb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top