« Back to Product

Documentation

AC_DeleteVariableData

Require: IP-Symcon >= 3.0

 int AC_DeleteVariableData (int $InstanceID, int $VariableID, int $StartTime, int $EndTime) 

Parameters

InstanceID

ID for the archive

VariableID

ID of the variable in which the data records are to be deleted

StartTime

Date/time as Unix Timestamp (0 = from the beginning)

EndTime

Date/time as Unix Timestamp (0 = until now)

Returns

Returns the number of deleted records

Description

This function deletes all logged data records of the variable with the ID VariableID in the period from start time up to and including end time. If the start time and the end time = 0, the logging of the variable is also deactivated.

Warning

If data records are to be deleted at a single point in time, the end time must be set equal to the start time

Warning

It should be noted that the Unix Timestamp is based on UTC+0. Many European countries have summer time (CEST/UTC+2) and winter time (CET/UTC+1).

Warning

After execution, the aggregation of the variable is invalid and must first be re-aggregated. AC_ReaggregateVariable can be used for this.

Warning

If the parameters start and end time = 0, the data records of the variable are completely deleted.

Example

// Deletes all data of the variable "TestVariable" in the period 07.10.2015 16:00 UTC+2(CEST) to 07.10.2015 17:00 UTC+2(CEST)
AC_DeleteVariableData(12345 /*[Archive]*/, 45678 /*[Variable]*/, 1444226400, 1444237200); 

// Deletes all data of the variable "TestVariable" in the period 07.10.2015 16:00 UTC+2(CEST) until now
AC_DeleteVariableData(12345 /*[Archive]*/, 45678 /*[Variable]*/, 1444226400, 0);

// Delete completely and remove from the Archive Control
// Deletes all data of the variable and deactivates the variable in the Archive Control
AC_DeleteVariableData(12345 /*[Archive]*/, 45678 /*[TestVariable]*/, 0, 0);
Any questions?