What can we improve?




Require: IP-Symcon >= 3.0

 array AC_GetLoggedValues (int $InstanceID, int $VariableID, int $StartTime, int $End time, int $Limit) 



ID for the archive


ID of the variable to be queried


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

End time

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


Maximum number of records. (0 = no limit, 10000 is the hard limit, which always applies)


An array with the following key => value pairs.

The output starts with the newest data set and then, in descending order, with the older dataset / datasets.

Index Type Description
Duration integer Duration in seconds that the data record was set
TimeStamp integer Date/time when the dataset / datasets was created as a Unix Timestamp
Value variant Value


This command returns the raw data that were also logged via the Archive Control for a variable with the VariableID. The Start - and End time can be specified as parameters. The parameter Limit limits the maximum number of data records returned, whereby the limit of 10000 data records per query can never be exceeded.

The Archive Control only creates new data records for changed values! Updates are not taken into account.

This function places a considerable load on the system, since in most cases a large number of data records have to be processed. In any case, please use the AC_GetAggregatedValues function to switch to pre-aggregated values. This function gives you direct access to mean values or sums for different periods of time such as years, months, weeks and days.

This function was bugged in IP-Symcon 2.x. One more value, which was before the start time, was always put out . This was useful insofar as the previous value was known for, for example, the generation of graphs, and a graph could be created for the entire period of time. Otherwise a gap would be visible at the beginning of the graph. However, this functionality is not correct for a function with the parameter start time.
If one requires exactly this special functionality for their scripts, one can use the auxiliary function, which queries the previous data record which is before the start time and adds it to the array.


//Get the last value that was saved in the database
$last_value = AC_GetLoggedValues(12345, 55554, 0, 0, 1)[0]['Value']; 

// Query all data records from 01/01/2013 to 01/07/2013
$values = AC_GetLoggedValues(12345, 55554, mktime(0, 0, 0, 1, 1, 2013), mktime(23, 59, 59, 1, 7, 2013), 0); //55554 is the ID of the variable, 12345 from the Archive Control

//Query all of today's records
$values = AC_GetLoggedValues(12345, 55554, strtotime("today 00:00"), time(), 0); //55554 is the ID of the variable, 12345 from the Archive Control

//Query all of yesterday's records
$values = AC_GetLoggedValues(12345, 55554, strtotime("yesterday 00:00"), strtotime("today 00:00")- 1, 0); //55554 is the ID of the variable, 12345 from the Archive Control

//This part creates an output in the script window with the queried values        
foreach($values as $value) {
    echo date("d.m.Y H:i:s", $value['TimeStamp']) . " -> " . $value['Value'] . PHP_EOL;

//Auxiliary function that simulates the functionality of IP-Symcon 2.x.         
function AC_GetLoggedValuesCompatibility($instanceID, $variableID, $startTime, $endTime, $limit) {
    $values = AC_GetLoggedValues($instanceID, $variableID, $startTime, $endTime, $limit );
    if((sizeof($values) == 0) || (end($values)['TimeStamp'] > $startTime)) {
        $previousRow = AC_GetLoggedValues($instanceID, $variableID, 0, $startTime - 1, 1 );
        $values = array_merge($values, $previousRow);
    return $values;