SVTREND

Concept Link IconSee also Concept Link IconExample

Retrieve the historic values of a group of variables between two given dates.

WebVue support - Yes.

The use of the verbs EXPORT, EXPORT_LOG and EXPORT_TREND is preferred to verbs SVLOG and SVTREND. The latter are kept for compatibility only.

The variables must be configured for trend recording.

Mode Mnemonic Syntax
1 GETTREND 1
2 GETNEXTBUFFER 2

Syntax 1

IntVal = SVTREND (Mode, ListVar, Branch, StartDate, EndDate, Period, [DisplayMode, Handle_Result, Parameters]);

Return type: INTEGER.

Argument

Meaning

ListVar EITHER
The handle of a buffer containing a list of variable names (separated by commas) involved in the extraction. Type LONG.
OR
A list of variable names (separated by commas) involved in the extraction. Type STR.
Branch The branch of the list of variables. Type STR.
StartDate The earliest date for extraction, in milliseconds since 1980. Type DOUBLE.
EndDate The latest date for extraction, in milliseconds since 1980. Type DOUBLE.
Period The sampling period in seconds. Type DOUBLE.
DisplayMode

The output format for the list of variables.

DisplayMode= 1 - The data is extracted using the list of variables in the buffer Handle_Listvar to the format defined by Format.
DisplayMode
= 2 - The sampled data for each variable will be contained on the same line preceded by its time and date stamp.

See the example for further details.

Handle_Result The handle of the buffer in which the result will be placed. Type LONG.
Parameters

EITHER
The handle of a buffer containing a list of comma separated values. Type LONG.
OR
A string containing a list of comma separated values. Type STR.

See below for more information on how to format this argument.

Execution

Mode Mnemonic Action
1 GETTREND

Extract trend (Historic) data for the list of trended variables, between two dates.

Return:

1 Parameters are correct.
-1 Parameter Handle_ListVar is null or of null length.
-2 Variable Str_ListVar could not be read.
-3 Parameter 1 is neither of type LONG nor STR.
-4 Parameter 2 is not of type STR.
-5 Parameter 3 is not of type DOUBLE.
-6 Parameter 4 is not of type DOUBLE.
-7 Parameter 5 is not of type DOUBLE.
-8 Parameter 6 is not of type LONG.
-10 Parameter 7 is not of type STR.
-11 Parameter 8 is not of type STR.
-12 Parameter 9 is not of type STR.
-13 Variable StrVar does not exist or has not been configured for trend recording.
-14 One of the items Handle_ListVar or Str_ListVar is not a variable.
-15 One of the variables Handle_ListVar or Str_ListVar does not exist.
-16 One of the variables Handle_ListVar or Str_ListVar is already being processed by SVTREND or HISTORY.
-17 Handle_ListVar or Str_ListVar is empty.

Format of the Parameters argument

The argument Parameters comprises the following items separated by a comma: Format, Filter, LogVar, NameVar

It passed either as a handle of a buffer, or directly as a string.

Item

Meaning

Format

The format of the time and date. Type STR.

#D for the day
#M for the month
#Y for the year as two characters
###Y for the year as four characters
#h for the hour
#m for the minutes
#s for the seconds
##l for the milliseconds

Any other characters are interpreted literally.

Filter The filter applied in the extraction. See the topic Native Filter Expressions. Type STR.
LogVar The name of a bit variable that will be set to 1 when the instruction is complete. Type STR.
NameVar The name of a register variable which value is the numeric Id of the variable currently being processed. Type STR.

Syntax 2

IntVal = SVTREND (Mode, Handle_Result);

Return type: INTEGER.

Argument

Meaning

Handle_Result

The handle of the buffer in which the data will be placed. Type LONG.

Execution

Mode Mnemonic Action
2 GETNEXTBUFFER Continues filling the buffer from the point previously reached. This mode is synchronous, e.g. the buffer is available for the execution of the next instruction.

Return:

0 No more data in the buffer.
1 Parameters are correct.
-1 No previous SVTREND instruction.
-2 Parameter Handle_Result is null or not initialized.

When SVTREND fills the buffer to its limit before all the data have been extracted, the mode GETNEXTBUFFER allows the process of extraction to be continued automatically.

Example

For an example, select the Example link above.