Documentation
CSV_ExportVariables
Require: Symcon >= 7.0
string CSV_ExportVariables (int $InstanceID, int $AggregationStage, int $AggregationStart, int $AggregationEnd)
Parameters
| InstanceID | ID of the instance |
| AggregationStage | Aggregation level analogous to AC_GetAggregatedValues, 7 for the raw data |
| AggregationStart | Date/time as Unix timestamp (0 = from beginning) |
| AggregationEnd | Date/time as Unix timestamp (0 = until now) |
Returns
The relative path to download the exported file or FALSE, if none of the selected variables exists.
Description
Exports the variables selected in the instance according to the export option as a CSV file or ZIP archive, like the button "Download Export Now". The aggregation level AggregationStage matches the one of AC_GetAggregatedValues, 7 exports the raw data. The file can be downloaded via the returned path and is replaced by the next export of the instance. CSV_DeleteZip deletes it. A single variable is exported regardless of the export options by CSV_Export.
Example
// Export the raw data of yesterday
$path = CSV_ExportVariables(12345, 7, strtotime('yesterday'), strtotime('today') - 1);
if ($path !== false) {
echo $path; // /hook/zip/12345
}