readEx
[ Function ]
Version 1.8
public static readEx(expression: string): any;
Version 1.12
public static readEx<T = any>(expression: string): T;
Reads the value of a symbol addressed via the symbol expression.
From version 1.10, symbol queries are executed directly against the component that makes the data available. Since a synchronous query of symbols from the server is not possible, please use the function readEx2 to query server symbols. |
Version 1.12: If the API is used in TypeScript code, the TypeScript compiler can be notified of the symbol value type. |
This is a merely an auxiliary programming feature. The browser does not recognize this "type annotation". No check or conversion takes place at runtime. |
Parameter
Name | Type | Description |
---|---|---|
expression | Symbol expression |
Return value
Type | Description |
---|---|
Version 1.8 Version 1.12 T | Current value of the symbol. |
Available from 1.8 |
Sample - JavaScript
var symVal = TcHmi.Symbol.readEx('%i%myInternalSym%/i%');
Sample 1 - TypeScript
let symVal = TcHmi.Symbol.readEx('%i%myInternalSym%/i%'); // TS does not know the variable type
Sample 2 - TypeScript
let thisIsABoolean = TcHmi.Symbol.readEx<boolean>('%i%myInternalSym%/i%'); // TS knows this is a boolean