diff --git a/Script Includes/evaluate-how-much-the-fields-is-used b/Script Includes/evaluate-how-much-the-fields-is-used new file mode 100644 index 0000000000..42833e8ed4 --- /dev/null +++ b/Script Includes/evaluate-how-much-the-fields-is-used @@ -0,0 +1,41 @@ +function calculatePercentUsed(table, field, time){ + + var countAll = new GlideAggregate(table); + if (time){ + countAll.addEncodedQuery(time); + } + countAll.addAggregate('COUNT'); + countAll.query(); + var allRecords = 0; + if (countAll.next()){ + allRecords = countAll.getAggregate('COUNT'); + gs.info('All records [' + table + ']: ' + allRecords); + + } + var arrayFields = field.split(','); + for (var i=0; i