Skip to main content
Version: V2 (Ignition 8.1)

system.mes.meter.pruneMeterRecords

Description

Permanently deletes Meter Records that ended before a specified date for the given list of equipment. Only completed records (records with an end date) are pruned.

Permissions

This method requires the METERING.WRITE.DELETE permission.

Syntax

system.mes.meter.pruneMeterRecords(equipmentIdsOrPaths, pruneBeforeDate)

Parameters

ParameterTypeNullableDescription
equipmentIdsOrPathsList<String>FalseList of equipment IDs or paths whose records should be pruned.
pruneBeforeDateDateFalseRecords that ended before this date will be permanently deleted.

Returns

Returns an integer representing the number of Meter Records that were pruned.

Code Examples

# Prune all Meter Records older than 90 days for a specific equipment
pruneBeforeDate = system.date.addDays(system.date.now(), -90)
prunedCount = system.mes.meter.pruneMeterRecords(
['Enterprise/Site/Line1'],
pruneBeforeDate
)

print("Records pruned:", prunedCount)