EXPRESSION
Dynamically import expression models or expressions on variables from a file or buffer.
WebVue support - Yes.
Mode | Mnemonic | Syntax |
0 | IMPORT_FILE_TEMP | 2 |
1 | IMPORT_BUFFER_TEMP | 1 |
2 | IMPORT_FILE_ONVAR | 2 |
3 | IMPORT_BUFFER_ONVAR | 1 |
4 | RECALCULATION | 3 |
5 | TRACE | 4 |
Syntax 1
IntVal = EXPRESSION(Mode, Handle[, Overwrite]);
Return type: INTEGER
Argument |
Meaning |
Handle |
Allocation of the memory buffer, as returned by ALLOC_BUFFER or FILETOBUF. Type LONG |
Overwrite |
Replace the previous buffer. Optional. 0: NO (default value) 1: YES |
Execution
Mode |
Mnemonic |
Action |
1 |
IMPORT_BUFFER_TEMP |
Import expression models from the specified buffer. |
|
|
Return: 1 if OK, else 0. |
3 |
IMPORT_BUFFER_ONVAR |
Import expressions on variables from the specified buffer. |
|
|
Return: >0 if OK, indicating the total number of items 0 if the format is not recognized, or the buffer is empty. -1 if the result variable of an expression already exists from another expression; the expression is not imported. -2 if the result variable does not exist. -3 if the expression is illegal |
Syntax 2
IntVal = EXPRESSION(Mode, FileName[, Overwrite]);
Return type: INTEGER
Argument |
Meaning |
FileName |
The name of the text file to be read, either from the TP folder of the project or using an absolute path. (Type STR) |
Overwrite |
Replace the previous file. Optional. 0: NO (default value) 1: YES |
Execution
Mode |
Mnemonic |
Action |
0 |
IMPORT_FILE_TEMP |
Import expression models as specified, from the specified file. |
2 |
IMPORT_FILE_ONVAR |
Import expressions on variables as specified, from the specified file. |
Return: 0 if the file could not be found or if it contained no element to import. Otherwise, a positive number corresponding to the number of lines processed as part of the import. A line may have been processed and not caused any configuration change if its syntax was invalid or if it referred to the deletion or modification of an element that did not exist in the configuration. |
Syntax 3
IntVal = EXPRESSION(Mode [, ExpressionName]);
Return type: INTEGER
Argument |
Meaning |
ExpressionName |
The name of an expression. (Type STR) |
Execution
Mode |
Mnemonic |
Action |
4 |
RECALCULATION |
Force a recalculation of the named expression on variable. If the expression name is not supplied, all expressions are recalculated. |
|
|
Return: 1 if OK, -1 if expression not found. |
Can only be used for expressions whose result is a variable. Cannot be used for expression templates.
Syntax 4
IntVal = EXPRESSION(Mode, SubMode);
Return type: INTEGER.
Argument |
Meaning |
SubMode |
Either "ON" or "OFF". Type STR. |
Execution
Mode |
Mnemonic |
Action |
5 | TRACE |
Activate ("ON") or deactivate ("OFF") diagnsotic messages. Trace message appear in the Event Window (F7) and are generated each time the result of an expression changes. Return: always 1 if successful, else 0. |
Trace message example
[SV.Exprvs] The traces are activated
[SV.Expr]<Internal.ExprResult> Expression Expr is processed, member Internal.Register02 has changed
[SV.Expr]<Internal.ExprResult> The expression result = 4.000000 (expression=Expr)
Example
For an example, select the Example link above.