Since you are doing integer math it is truncating the remainder

You state 'Total Time' is an integer so it can never show 6.08

Fred

-----Original Message-----
From: Action Request System discussion list(ARSList) 
[mailto:[email protected]] On Behalf Of Jase Brandon
Sent: Tuesday, March 22, 2011 5:17 PM
To: [email protected]
Subject: Trying to convert Integer field value into Hours divided by 60.

** Hello All,
I am writing a custom time tracking app and have been banging my head on the 
keyboard for a few hours with the below.

I have one Active Link and three fields: 'Minutes', 'Hours', and 'Total Time' 
all are Integer/Numeric Spinner/Display Only.
'Minutes' and 'Hours' are populated by a COLSUM functions on a table field and 
that part is working great.
I want to be able to take 'Minutes' and 'Hours' and populate 'Total Time' 
field, so a user can do a date range search on Monday-Friday and see if they 
have entered a full 40 hours. 
My problem is this:

'Hours' and 'Minutes' both work great and are populated with the correct values 
from the table field using COLSUM.

I have an Active Link with three Set Fields.
Action 1: Set FieldsĀ  'Hours' = COLSUM(Column38). 
Action 2: Set Fields 'Minutes' COLSUM(Column39). 
Action 3: Set Fields 'Total Time' = 'Hours' + ('Minutes' /60)

Action 3 is what is causing the pain.

Ex
Action 1 uses COLSUM and sets the 'Hours' as 4 hours, and that's correct.
Action 2 does the same COLSUM function and comes up with 128 Minutes, and 
that's correct.
Action 3 sets 'Total Hours' as 6 Hours with NO minutes. So, the workflow it's 
picking up the fact that when I divide by 60 in action 3 it works, but... it's 
not taking into account the other 8 minutes.
So the problem is that when 'Hours' = 4, and 'Minutes' = 128... I get the 
result in 'Total Time' as 6, instead of 6.08. I need the 'Total Time' field to 
populate with exact Hours/Minutes.

The only thing I have come close with if using another Decimal Integer field 
with a Precision of 2 as 'Total Time'.. but.. that gives me a time of "2.13" 
for "2 Hours and 8 Minutes", as it should. 13% of 60 is 8.
How can I overcome this? I haven't done anything like this in quite awhile and 
I am admittedly stumped.

ARS 7.1
Windows 2003
ITSM 7.0.0.3

Thanks in Advance to All with any advice for me. :-)

Cheers,

Jase Brandon
Senior Remedy Developer
Quality Technology Services
300 Satellite Blvd
Suwanee, GA 30024

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"

Reply via email to