Print Page | Close Window

CEILING to 0.05 in CR 10

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12637
Printed Date: 18 May 2024 at 2:56pm


Topic: CEILING to 0.05 in CR 10
Posted By: MAwadi
Subject: CEILING to 0.05 in CR 10
Date Posted: 16 Mar 2011 at 9:50pm
Hi Every One
 
I Use a Crystal Report 10 Version 10.0.0.533. There is not a function CEILING as in Ms Excell. I have a Calculating field.
 
So how can i make ceiling to 0.05?
 
Ex:
7.33 will become 7.35
7.5   will become 7.5
7.88 will become 7.9



Replies:
Posted By: lockwelle
Date Posted: 17 Mar 2011 at 3:24am
my thought would be to code a function for the report.  since you know the number of decimal places desired, you could write a function like:
pass in the number(x), pass in the ceiling value (y)
 
local numbervar temp := x/y;
if temp - int(temp) <> 0 then
  temp := int(temp) + 1;
temp * y
 
HTH


Posted By: MAwadi
Date Posted: 19 Mar 2011 at 5:38am
Thank u for ur reply
but i try many ways and many function. but i didin't get what i need.


Posted By: MAwadi
Date Posted: 20 Mar 2011 at 1:22am

Finally I find the way. This is the idea  Ex: 7.33

A = 7.33
B = Round(7.33,1) The Result is 7.30
C= A-b The Result is 7.33-7.3 = .03
 
If C = 0.05 or -0.05 then 0
elseIf (0.05-C) < 0.05 and C > 0 then 0.05-C
elseIf 0.05 - C > 0.05 Then C-0.05
 
Thank Every Body
 



Print Page | Close Window