Metric Definition - Past Data

duv
Mega Explorer

Created a Metric Definition, using SN_GRC_Issue, for the purpose of capturing Duration of Issue by Priority. Metric Definition is created, but not pulling past data... how to fix? I have one for Duration of Issue by State, which works fine. 

1 REPLY 1

sizzleMcFace
Giga Guru

Metric definitions will start recording data when they are created, they will never pull past data by default.

 

You can generate past data by writing a script (Scheduled Script or Fix Script) that will retroactively create and populate metric_instance records. To capture the right values for "Start", "End", "Field value", etc., you can use the sys_audit table.

 

Basically you would iterate through the records for which you want to create historic data and then for each record, you would look up the relevant sys_audit records and create a metric_instance record with the correct values.

 

It might be best from a performance perspective to do this in a Schedule Script execution which runs regularly, does a couple hundred or thousand records at a time, and somehow marks after each run where it's at (maybe going in order of "sys_created_on" and recording the last processed record's "sys_created_on" in a sys_property.