[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-developers] SOLVED - ASP always round up



> Have a need to always round up returned number values. Any 
> ideas on how to
> achieve this with ASP on a RAQ4R?
> 
> I have looked at Round(var) but see no way to always round up 
> to the nearest
> whole number.
> 
> .net has a function called 'ceiling' which performs what I 
> want...anything
> like that in ASP I'm not aware of?


Hi all,

Messy I know, but the solution that tested ok with was -

stringVAR = CSTR(originalVAR)
positionVAR = INSTR(stringVAR, ".")
If positioVAR > 0 Then
resultsVAR = CINT(left(stringVAR, postitionVAR - 1))
finalVAR = QresultsVAR + 1
Else
finalVAR = originalVAR 
END If

Basically what happens is -
1. Convert to a string
2. read the decimal (.) position
3. round up if postions greater than 0
4. leave as original whole number if position equals 0

Had to add in step 4 to make results test 100% OK.

 
regards,
 
Todd Kirk