Define a conditional IF... ELSE for a MENU Item
Syntax IF...ELSE : see How to use IF ... ELSE conditional on a "boolean-specifier" (i.e.,VALIDITY)
1. First, define the "items" of the MENU
2. Second, define the conditional statement which includes either an "IF" and a "ELSE"
MENU conditional_menu { LABEL "Conditional Menu"; STYLE WINDOW; ITEMS { var_conditional IF (var_conditional == 1) { // Dynamic Variables PV.DEVICE_VARIABLE.DIGITAL_VALUE(DISPLAY_VALUE), SV.DEVICE_VARIABLE.DIGITAL_VALUE(DISPLAY_VALUE), PV.DAQ.ANALOG_VALUE(DISPLAY_VALUE, READ_ONLY), PV.RANGING.LOWER_RANGE_VALUE(DISPLAY_VALUE, READ_ONLY), PV.RANGING.UPPER_RANGE_VALUE(DISPLAY_VALUE, READ_ONLY) } IF (var_conditional == 2) { // Device Variables pressureValue, pressureUnits, temperatureValue, temperatureUnits concentrationValue, concentrationUnits } } }
Note:
(1) The IF is fully braced and there does not need to be a corresponding ELSE
(2) There are two concatenated MENU item lists and the last item does not have a "comma"
VARIABLE var_conditional { LABEL "Choose Menu Items"; CLASS LOCAL; HANDLING READ & WRITE; TYPE ENUMERATED { { 0, "None"}, { 1, "Dynamic Variable" }, { 2, "Device Variables" } } }
The VARIABLE var_conditional has not DEFAULT_VALUE but the first item listed is the value zero which is the initial value that the EDD host will display
The EDD host application will display the following screens
var_conditional = 0
var_conditional = 1
var_conditional = 2