- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 10:03 AM
Hi all,
Wondering if someone had any ideas on how I could make this work. On our Outage table I have the start, end, and duration field with a business rule to calculate the difference between start and end to come up with the duration (normal stuff) but from here what I would like to do is convert this to minutes and copy those minutes into an integer field so that I can use the variable in future calculations (cost, duration, etc).
Played around with a few things so far. Setting attribute of max_unit=minutes on the duration field does break it down to minutes but when trying to pass the variable off to another field it still holds onto the full date and time format of Jan 1970. I always found duration fields to be a bit tricky so wanted to throw this out there and see if anyone has done this in the past or has an idea on how this could be accomplished. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 10:09 AM
Hello Bhadley,
I think something like this should do it:
var minutes = current.duration / 1000 /60;
current.fieldToStoreMinutes = minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 10:09 AM
Hello Bhadley,
I think something like this should do it:
var minutes = current.duration / 1000 /60;
current.fieldToStoreMinutes = minutes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 10:56 AM
Thanks Edwin,
You got me going in the right direction. I had to format out the duration field a bit more but got it to work using the below;
var duration = current.duration.getGlideObject().getNumericValue()
var durationMinutes = (duration/1000/60);
current.u_duration_minutes = durationMinutes.toFixed();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-25-2015 11:00 AM
Thanks Bhadley! I'm glad you got it to work!.