AddStatement

(Engine-Level Function)

Description: Adds a new statement to an existing state and returns its own error code.
Warning: This function should be used only by advanced programmers.
Returns: Error code on failure or a #VTypeModStateStmnt code value on success.
Usage: Script Only.
Function Groups: Compilation and Online Modifications,  States
Related to: AddVariable | MakeDAG | Compile
Format: AddStatement(Statement, Destination, TextSize)
Parameters:  
Statement
Required. Any expression that returns a statement value. Commonly generated with the Compile function.
Destination
Required. Any expression that returns a code value.
This indicates where to insert the new statement. If no statement is present in the code value, the new statement will be appended.
TextSize
Required. Any numeric expression giving the length of the statement text, measured in characters.
Comments:

Seldom (if ever) used when adding features to modern VTScada applications.

AddStatement does not affect the .SRC file. It affects the expected location of items in the .SRC file. Both must be updated in unison.
The return value is a #VTypeModStateStmnt code value if successful and an error code if the function fails.
AddStatement is disabled in the run time version of VTScada where it will do nothing and return invalid.