[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

i need to get the time value from a decimal Value

Posted on 2009-02-09
14
Medium Priority
?
382 Views
Last Modified: 2012-05-06
for example if i have decimal value : 14.90
i need to get the time value that is : 15.30 HH.MM
how can i do it in the report ?
thanks
0
Comment
Question by:Tech_Men
  • 8
  • 4
  • 2
14 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 23596943
Can ypu give other examples?

Generally values like that are 14 hours and .9 of an hour or 54 minutes so it it 14:54
If it really is 15.30 then what is 15.3 in your database?

mlmcc
0
 

Author Comment

by:Tech_Men
ID: 23598242
14.90 its 14 hours and 90 min
from the 90 min we have 1 hour + 30 min
so we have 14 + 1.30 = 15.30
this is waht i need to calc
i hope that u help me...
0
 
LVL 4

Expert Comment

by:spangdelta
ID: 23599735
Try this:
Assuming @time1 is the original time value,

floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
+
(
   (
    ({@time1} - floor( {@time1})) * 100 -
    (floor(({@time1} - floor( {@time1})) * 100/60) * 60)
   )
  / 100
)

It SEEMS to work....
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:Tech_Men
ID: 23599896
in the report i made a formula whit this code :

floor(Sum ({Msam.TotalHour}),1) + floor(((Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100 / 60))
+
(
   (
    (Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100 -
    (floor((Sum ({Msam.TotalHour}) - floor( Sum ({Msam.TotalHour}))) * 100/60) * 60)
   )
  / 100
)
but i am geting this message :
The remaining text does not appear to be part of the formula.
0
 
LVL 4

Expert Comment

by:spangdelta
ID: 23599917
You should have cut/pasted my formula.
For one thing, you have 3 right parens on the end of your first line, where I have 2....
0
 

Author Comment

by:Tech_Men
ID: 23599941
Sum ({Msam.TotalHour})  in here i have the value that need to turn it to time
can u type it in youer forumla and send it here fix?
thanks ..
0
 
LVL 4

Expert Comment

by:spangdelta
ID: 23600572
Create a formula field named time1, and set its value to "Sum ({Msam.TotalHour})"
Then just use my formula.
0
 

Author Comment

by:Tech_Men
ID: 23600620
i creatd a formula called @time1
inside it i put this code :
Sum ({Msam.TotalHour})

what know ?
0
 
LVL 4

Assisted Solution

by:spangdelta
spangdelta earned 400 total points
ID: 23600645
Now, create the calculated time formula using the formula I gave you above:
floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
+
(
   (
    ({@time1} - floor( {@time1})) * 100 -
    (floor(({@time1} - floor( {@time1})) * 100/60) * 60)
   )
  / 100
)
0
 

Author Comment

by:Tech_Men
ID: 23600691
i need to creat a new formula ?
0
 

Author Comment

by:Tech_Men
ID: 23600736
i cretad n new formula call : CalcTime
and i put youer code into
then i drag the calc formula into the report
when i run the report i am geting this Exsption :
 
Error in File C:\DOCUME~1\simon\LOCALS~1\Temp\temp_b75aadc1-f54d-407a-854f-30353b8eb028 {203C465B-CB5C-4A40-8D7E-486F1A90E4E4}.rpt:
Error in formula  <@Calc>.
'floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
'
The remaining text does not appear to be part of the formula. ---> System.Runtime.InteropServices.COMException (0x80041019):
Error in File C:\DOCUME~1\simon\LOCALS~1\Temp\temp_b75aadc1-f54d-407a-854f-30353b8eb028 {203C465B-CB5C-4A40-8D7E-486F1A90E4E4}.rpt:
Error in formula  <@Calc>.
'floor({@time1},1) + floor((({@time1} - floor( {@time1})) * 100 / 60))
'
The remaining text does not appear to be part of the formula.
 
0
 

Author Comment

by:Tech_Men
ID: 23602956
someone ?
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1600 total points
ID: 23603553
Are you using Crystal or Basic syntax in your formulas?

You should use Crystal syntax.

Here is a slightly easier formula

local numbervar time1 := {@time1};

local numbervar hours1;
local numbervar minutes1;
hours1 := truncate(time1);
minutes1 := time1 - hours1;
minutes1 := minutes1 * 100;
if minutes1 >= 60 then
(
    hours1 := hours1 + 1;
    minutes1 := minutes1 - 60;
);
hours1 + minutes1/100  

mlmcc
0
 

Author Closing Comment

by:Tech_Men
ID: 31544803
A++
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Loops Section Overview
Screencast - Getting to Know the Pipeline

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question