Delete historical scores from indicators
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 12:47 AM
Hi everyone,
We have some indicators created before go-live and we would like to have these scores deleted for the period before go-live, because otherwise the trend is biased.
Do you happen to know a way of doing this, other than manually (it wouldn't be a problem if it wouldn't take too much time)?
Best regards,
Oana
- Labels:
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2016 06:50 AM
Hi Oana,
You can use a script to delete the data. I suggest using a scheduled job to run the script or else you risk timing out. Something like the below could work:
//delete records. Make sure to test the count first and make sure that you are querying the correct records then outcomment the delete command
deleteRec();
function deleteRec() {
var rec = new GlideRecord('pa_scores');
rec.addQuery('start_at','<', 20151001); // This deletes all data from before the date value.
rec.query();
var count = 0;
while(rec.next()){
//gs.print(rec.name);
count++;
}
gs.log('Scheduled Job: Delete PA Scores will delete ' + count +' records.'); // Run with this line before actually outcommenting the last line of code.
//rec.deleteMultiple(); // Enable this line when the desire amount is returned in the script log above.
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2020 10:54 AM
I accomplished a historical cleanup using the following method.
1. Add a condition to your Indicator with a condition that will never return true (i.e. Active=true AND Active=false)
2. Create a new Job.
- Score operator=Fixed
- Score fixed start=On or before the day you started collecting data
- Score fixed end=Day before you went live
- Run=On Demand
- Associate your Indicator with the Job
3. Hit Execute Now and wait for the job to complete. Continue to step 4.
4. REMOVE the conditions you added to your Indicator.