ph_getvar_s PowerHome formula function
Description
Retrieves the specified system variable as a string.
Syntax
ph_getvar_s ( type, num )
Argument |
Description |
type
|
Integer. The type of system variable you wish
to retrieve. Valid values are 1, 2, 3, and 4. A 1 specifies that you wish
to retrieve LOCAL variables (the same as system variables LOCAL1 thru
LOCAL10), a 2 specifies that you wish to retrieve TEMP variables (the same
as system variables TEMP1 thru TEMP10), and a 3 specifies that you wish to
retrieve GLOBAL variables (the same as system variables GLOBAL1 thru GLOBAL20). A value of 4 is a special case and represents data that is only available during the execution of Analog I/O formulas (the Calculated to Raw and Raw to Calculated formulas). Use a num value of 1 to return the raw value as a string. Use a num value of 2 to return the calc value of the Analog device as a string. This would look like ph_getvar_s(4,1) and ph_getvar_s(4,2). |
num
|
Integer. The number of the specified system variable type you wish to retrieve. To retrieve system variable TEMP7 use ph_getvar_s(2,7).
|
Return value
String. The data stored within the specified system variable returned as a string. The default storage format for the LOCAL, TEMP, and GLOBAL system variables is as a string so this function is safe to use with any type of data.
Examples
The following examples demonstrate typical syntax/ usage for this function.
• ph_getvar_s (1,2) --> get the contents of LOCAL2. The result is returned as a string.
• ph_getvar_s (2,4) --> get the contents of TEMP4. The result is returned as a string.