ph_setanalogdisplay PowerHome formula function
Description
Sets the display values associated with records in the analogio table (Analog I/O screen) that will display in the Device Status screen
Syntax
ph_setanalogdisplay ( al_foreground, al_background, as_graphic, ai_refresh )
ph_setanalogdisplay ( as_id, al_foreground, al_background, as_graphic, ai_refresh )
Argument Description
as_id String (Optional). The ID of the record in the analogio table. If this parameter is omitted the system variable ANALOG will be used for the ID
al_foreground Long. The foreground color to display in the Control area of the Device Status screen. Use a negative number to use the existing value
al_background Long. The background color to display in the Control area of the Device Status screen. Use a negative number to use the existing value
as_graphic String. The path and filename of a graphic to display in the Control area of the Device Status screen. Use a string containing a single space " " to use the existing value
ai_refresh Integer. Use 0 to update the table but not refresh the Device Status screen if open. Any other value will update the table as well as refresh the open Device Status screen
Return value
Integer. Returns 0 if successful. Returns 1 if the ID does not exist. Returns 2 if the analogio table cannot be updated
Usage
Since the Analog I/O screen only contains a single setting for foreground, background, and graphic, this function allows the user flexibility in changing these static values based upon the current value of the particular Analog I/O point. This function may be called in the CalctoRaw and RawtoCalc formulas defined for the Analog I/O point. If called from within the CalctoRaw or RawtoCalc formulas, you can use the syntax that omits the as_id parameter
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_setanalogdisplay("KITCHENLIGHT", -1,rgb(255,255,0)," ",1) - Sets the background color for the KITCHENLIGHT Analog I/O device to yellow. The foreground color and graphic is unchanged. The Device Status screen is refreshed to show the changes.