read
[ Function ]
Version 1.8
public static read(name: string, type: TcHmi.SymbolType): any;Version 1.12
public static read<T = any>(name: string, type: TcHmi.SymbolType): T;Reads the value of a symbol addressed by its name and symbol type.
![]()  | 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  | 
|---|---|---|
name  | Name of the symbol  | |
type  | Symbol type  | 
Return value
Type  | Description  | 
|---|---|
Version 1.8 Version 1.12 T  | Current value of the symbol, can be of any type.  | 
![]()  | Available from 1.8  | 
Sample - JavaScript
var symVal = TcHmi.Symbol.read('myInternalSym', TcHmi.SymbolType.Internal);Sample 1 - TypeScript
var symVal = TcHmi.Symbol.read('myInternalSym', TcHmi.SymbolType.Internal); // TS does not know the variable typeSample 2 - TypeScript
let thisIsABoolean = TcHmi.Symbol.read<boolean>('myInternalSym', TcHmi.SymbolType.Internal); // TS knows this is a boolean