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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding up to the nearest quarter 1

Status
Not open for further replies.
Jan 20, 2003
41
US
I am attempting to round up to the nearest quarter on 1005680VW_SC_PASSPORT.DIRECT_DURATION} the Duration is given in minutes. I divided these minutes by 60 to get total hours. I need to round up to the nearest quarter. I have a value of (95/60) = 1.58, the business side wants it rounded to the next highest quarter (never rounded down). the 1.58 should be 1.75.

Should I write a case statement with the ranges in order to accomplish this? or is there a better way?



Select {1005680VW_SC_PASSPORT.SERVICE_CODE}

CASE "B001":
17.5

CASE "B002":
35

CASE "C001":
10
CASE "C002":
round(({1005680VW_SC_PASSPORT.DIRECT_DURATION}/60),1)
CASE "C003":
round(({1005680VW_SC_PASSPORT.DIRECT_DURATION}/60),1)

CASE "P002":
1

CASE "P003":
{1005680VW_SC_PASSPORT.DIRECT_DURATION}/15

CASE "P005":
1
CASE "P006":
1

CASE "P008":
{1005680VW_SC_PASSPORT.DIRECT_DURATION}/15
CASE "P009":
1
 
Take a look at thread767-491558 it might point you in the right direction. Reebo
Scotland (Going mad in the mist!)
 
Here is the formula if you want to always round up to the next 0.25. I built it off of the thread the Reebo suggests. The thread shows how to round to the nearest .25, not up to the next .25.


numbervar x:={your.field};

if round(x*4)/4<x then

round(x*4)/4+.25
else

round(x*4)/4 Mike
 
When I add the code suggested, I can run the report but when I exit out and attempt to reopen the report. I get memory full messages. Is there a resolution for this?
 
At what point do you get the 'memory full' message? Is this a windows error or a Crystal error? Reebo
Scotland (Going mad in the mist!)
 
Hey,

'Memory full' is a very generic error message, which can sometimes be solved by closing redundant applications on your client.

There are actually many different potential reasons you may get this error. Go to and download the Memory Full whitepaper: cr_memoryfull.pdf.

If it's the addition of the above formula that seems to be the catalyst, and you can confirm there are no other variables in the report, then it may be that the usage of variables is causing the fault. This is rare and something I've not seen in action before, but a hot fix for this is available on the support site.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top