Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

Example: Script mapping

The Age breakdown uses the Incident.Age.Days script to calculate the age of incidents in days and map the values to the Incident Age Ranges bucket group.

In the first two images, you see the Age breakdown, which uses the Incident.Age.Days breakdown source and the Incident.Age.Days script for breakdown mapping. You also see that the breakdown source refers to the Incident Age Range (Days) bucket group.

Image omitted: age-breakdown.png
The age breakdown with Incident.Age.Days source and mapping highlighted.
Image omitted: incident-age-days-bkdown-source.png
The Incident.Age.Days breakdown source showing the Incident Age Ranges bucket group

The Incident.Age.Days script takes the time stamp when the incident was opened from the incident table and subtracts this from the time stamp at the end of the collection period. The script converts this value from milliseconds to days.

var diff=function(x,y){return y.dateNumericValue() - x.dateNumericValue();};
var days=function(x,y){return diff(x,y)/(24*60*60*1000);};
days(current.opened_at, score_end);

The resulting numbers of days are sorted into the buckets of the bucket group.

Image omitted: incident-age-ranges-bucket-group.png
Incident Age Ranges bucket group buckets

Here is the result of running this script on the Number of open incidents indicator.

Image omitted: detailed-scorecard-age-breakdown.png
Analytics Hub for the Number of open incidents indicator showing the Age breakdown.

Parent Topic:Create a breakdown mapping on a breakdown record

Related topics

Scripting in Performance Analytics