Avatar of mguptill
mguptill asked on

Rounding issue

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.
WhilePrintingRecords;
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)

Open in new window

Crystal Reports

Avatar of undefined
Last Comment
mguptill

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
habibb

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
mguptill

Thanks for the comments I will test these and get back to you.
ASKER
mguptill

mlmcc this worked great than you. $00pts

Habibb this solution worked but I was really looking for a solution in crystal. also I don't think the veiw would let use this variable in it. 100pts to you for taking the time to answer. Thanks both of you
ASKER
mguptill

Man did I fat finger that comment or what sorry.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23