Many Thanks to you all for the input and ideas. Issue Resolved. :-)
On Wed, Mar 23, 2011 at 3:45 AM, ARSmarts Support <[email protected]>wrote:
> **
> Dear,
>
> I would suggest to have two fields for the total time: one for the total
> number of hours, and one for the total number of minutes. Because the
> notation 1.01 to represent 1 hour and 1 minute is not clear.
> The first field (zTmpTotHour) should contain
> COLSUM(hours)+COLSUM(minutes)/60
> The second field (zTmpTotMin) should contain COLSUM(minutes)%60 (the modulo
> operator)
>
> Now if you really want to have a single field containing both, you add a
> character field, and you concatenate the result: zTmpToHour + "." +
> LPAD("00", zTmpTotMin)
>
> Best regards,
> ARSmarts Support Team
>
>
>
> ARSmarts, your most useful AR System companion.
> www.ARSmarts.com
>
>
> On 23 Mar 2011, at 01:12, Jason wrote:
>
> **
> Off the top of my head...
>
> Add 2 real number fields.
> ztmp_CalculateTime
> ztmp_CalculateTimeHour
>
> Add 1 character field
> ztmp_CalculateTimeDisplay
>
> 1 Active link or filter with 5 set field actions.
> Set field Action 1, Set ztmp_CalculateTime = $YourSourceField$
> Set field Action 2, Set ztmp_CalculateTime = $ztmp_CalculateTime$ / 60
> Set field Action 3, Set ztmp_CalculateTimeHour =
> LEFT($ztmp_CalculateTimeHour$, (STRSTR($ztmp_CalculateTime$, ".")))
> Set field Action 4, Set ztmp_CalculateTime = $ztmp_CalculateTime$ -
> $ztmp_CalculateTimeHour$
> Set field Action 5, Set ztmp_CalculateTimeDisplay =
> ($ztmp_CalculateTimeHour$ + ".") + LEFT(($ztmp_CalculateTime$ * 60), 2)
>
> Alternate step 5 as plain text
> Set field Action 5, Set ztmp_CalculateTimeDisplay =
> (($ztmp_CalculateTimeHour$ + " Hour(s) ") + LEFT(($ztmp_CalculateTime$ *
> 60), 2)) + " Minute(s)"
>
>
>
> Jason
>
> ------------------------------
> *From:* Jase Brandon <[email protected]>
> *To:* [email protected]
> *Sent:* Tue, March 22, 2011 7:18:32 PM
> *Subject:* Re: Trying to convert Integer field value into Hours divided by
> 60.
>
> ** Thanks Christie and Fred,
> I should have mentioned I've already tried using Real, Integer, Char, etc.
>
> I should have stated:
>
> "I want to be able to take a value of "61" in any type field, and convert
> that somehow to be interpreted as 'Total Time' = "1.01" or "One Hour One
> Minute", etc.. in any format.
> What would you guys suggest for accomplishing this goal? I'm admittedly
> tired and frustrated right now. Thanks in Advance... :-)
>
> Jase :-)
>
> On Tue, Mar 22, 2011 at 6:41 PM, Grooms, Frederick W <
> [email protected]> wrote:
>
>> 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"
>>
>
> _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
> _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
>
>
>
>
>
>
> _attend WWRUG11 www.wwrug.com ARSlist: "Where the Answers Are"_
>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"