- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 06:09 AM
I am trying to create a breakdown that will bucket scheduled report run times into 15-minute buckets. i have created a pa_bucket record with 96 entries for each fifteen-minute block of the day, and now need to create the script to evaluate and parse the run_time field on the scheduled report table.
I attempted to follow this community article, but since run_time appears to be a string or time field and not a datetime field, it doesn't work. I just get an NaN error when I try to evaluate.
Suggestions? Below is my current (not working) script.
var get15MinuteBucket = function (time)
{
var mSecs = parseInt(time);
var min = mSecs * 96;
return Math.floor(min / 15);
};
get15MinuteBucket(current.run_time.getNumericValue());
Solved! Go to Solution.
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 11:22 AM
One of my org's devs helped me nail this down with a logging script. The field run_time was coming back in milliseconds, which is what I was missing. The below snippet returns a value from between 0 and 95.99, which is the number of 15-minute blocks in a day.
All my records came back as 5am onward, so I subtracted 20. This is due to time zones, so update the "- 20" part to reflect the number of 15-minute blocks between your TZ and GMT.
var get15MinuteBucket = function (time)
{
var mSecs = parseInt(time);
var min = mSecs / 60000;
return Math.floor(min / 15) - 20;
};
var rt = new GlideDateTime(current.run_time.getValue());
get15MinuteBucket(rt.getNumericValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2022 11:22 AM
One of my org's devs helped me nail this down with a logging script. The field run_time was coming back in milliseconds, which is what I was missing. The below snippet returns a value from between 0 and 95.99, which is the number of 15-minute blocks in a day.
All my records came back as 5am onward, so I subtracted 20. This is due to time zones, so update the "- 20" part to reflect the number of 15-minute blocks between your TZ and GMT.
var get15MinuteBucket = function (time)
{
var mSecs = parseInt(time);
var min = mSecs / 60000;
return Math.floor(min / 15) - 20;
};
var rt = new GlideDateTime(current.run_time.getValue());
get15MinuteBucket(rt.getNumericValue());