PurgeAllPropertyHistory
Description
When logged properties are updated, their data is written to a value stream that is associated with the Thing. You can use the PurgeAllPropertyHistory service to purge historical data from all logged properties of a Thing for a specified time range.
The property history of the Thing on which the service is called will be purged. If you want to purge data for multiple Things, you must call the service on each Thing.
Inputs
Parameter Name
Description
Base Type
startDate
The start date, including the specified date, from which the historical data should be purged.
DATETIME
endDate
The end date, including the specified date, up to which the historical data should be purged.
DATETIME
Output
None.
Example
In the following example, the Thing has two logged properties, propertyA-Logged and propertyB-Logged, that have been updated multiple times. The historical data of both properties can be purged together using this service.
The input parameters can be passed inline as shown below:
// Purging historical data of all logged properties between the given start and end dates
Things["TestThing"].PurgeAllPropertyHistory({
startDate: '2024-05-12T16:58:28.000Z' /* DATETIME */,
endDate: Date.now() /* DATETIME */
});
Or you can construct an infotable:
// Params for purging historical data from the past year
var purgeAllPropertyHistoryParams = {
startDate: new Date(new Date().setFullYear(new Date().getFullYear() - 1)),
endDate: Date.now()
};

Things["TestThing"].PurgeAllPropertyHistory(purgeAllPropertyHistoryParams);
Was this helpful?