troubleshooting Question

Rounding issue

Avatar of mguptill
mguptill asked on
Crystal Reports
5 Comments1 Solution1187 ViewsLast Modified:
I have a decimal number field that is rounding up to the nerest hundreth. for example the number displayed in the database (SQL 2000) is .1666666etc the formula in the report displays3 numbers but it rounds the hundedth place up so on the report it displays .167. I would like it not to round so it displays .166 but I also want .033 to be .033 and not round down. I have not had any luck with searches so far so I was hoping maybe someone here would be able to help me. The snippet has the formula being used to display the decimal numbers.
Shared StringVar TimeType;
NumberVar nSHours;
If not IsNull({vmainview.staff_time})
  then nSHours := Truncate({vmainview.staff_time});
If IsNull({vmainview.staff_time})
  then '0'
  else if TimeType = 'R'
           then ToText(nSHours,0) + ':' + Right('00' +ToText(( ({vmainview.staff_time} - nSHours ) * 60),0), 3 )
           else ToText({vmainview.staff_time},3)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros