The following chapter describes the syntax that is usable in the expressions of objects of Eval tag type and the statements of objects of Historical value type.
The initialization part must always start with the INIT keyword. This part may contain:
The initialization part is optional. If it is not declared, the original syntax is valid.
If the initialization part has been declared, the expressions, determining the value of the object, must be specified after the FINALLY keyword.
The number of executed rows is limited in D2000 systems. Nowadays, the number cannot be defined or changed at all.
The number (ExecuteRows) depends on the type of used process.
For process D2000 Calc:
For process D2000 Archiv:
If the value of a different type is assigned to the system variable, a runtime error occurs while the expression is executing. The runtime error stops the script evaluation (the other rows will not be evaluated) and always returns an Invalid value. To display this error, activate "debug runtime errors".
Exceptions:
Calculation of the sum of the values in column A2 of the structured variable SV. The sum only includes the values of the lines, where the value in column A1 is greater or equal to 3.
INIT
INT _rows
INT _rowNr
REAL _sum
_rows := SV.A\DIM
_sum := 0.0
START:
_rowNr :=1
CYCLE:
IF SV.A[_rowNr]^A1 < 3 GOTO SKIP:
_sum := _sum + SV.A[_rowNr]^A2
SKIP:
_rowNr := _rowNr + 1
IF _rowNr <= _rows GOTO CYCLE:
FINALLY
_sum
This example shows a sequence number of one-third of the running minute - three ways of value return.
INIT
INT _third
IF Sec <= 20 THEN
RETURN 1
ELSIF Sec <= 40 THEN
_third := 2
RETURN _third
ELSE
_third := 3
EXIT
ENDIF
FINALLY
_third
In both examples, the timestamp of the expression will acquire the time of evaluation of the expression. If the expression is expected to acquire other value than the time of evaluation of the expression, it should be defined in the expression (after FINALLY!).
Example:
FINALLY
%NtV(_sum, _time)
To define the user flags for the resultant value of the expression, specify the definition of user flag in the expression.
Example:
FINALLY
%SetFlags(_sum, @A, _boolean)