Control Operators
Control operators enable you to use control information in your expressions or even influence the current state of a control. These expressions will help you to set up advanced menu paths and display conditions. Learn how to further enhance your users' experience using the control operators.
SELECTED
The SELECTED operator is used to determine the value of a selected item. Often, this operator will be used in the context of a menu to determine the _id of a selected document.
Syntax
SELECTED(pointer,property)
-
pointer - A pointer to a control.
-
property - The property for which the value should be returned.
Example
SELECTED([ CTRL["filter-grid"], "_id" ])returns the _id of the document in the selected line in thefilter-gridcontrol.
CHECKED
The CHECKED operator is used to determine the value of a checked item. Often, this operator will be used in the context of a disabled condition for a button, to determine whether the user should be able to click the button. Also in the context of an overlay layout this expression is used to determine the value that should be stored in the reference field.
Syntax
CHECKED(pointer,property)
-
pointer - A pointer to a control.
-
property - The property for which the value should be returned.
Example
CHECKED(CTRL["filter-grid"], "_id")returns the _id of the document in the checked line in thefilter-gridcontrol.
ISOVERLAYLAYOUT
The ISOVERLAYLAYOUT operator is used to determine whether a layout is currently rendered as overlay layout. This operator returns true or false. This operator is commonly used to conditionally hide buttons if the layout is rendered as overlay layout.
Syntax
ISOVERLAYLAYOUT(pointer)
- pointer - [ OPTIONAL ] - A pointer to a layout (
LAY[]). The pointer is only required if the expression is conditional on another layout than the one it is used in.
Examples
ISOVERLAYLAYOUT(LAY["ordersOverview"])returnstrueif theordersOverviewis rendered as overlay layout.ISOVERLAYLAYOUT()returnstrueif the layout containing this expression is rendered as overlay layout.
SETSTATE
The SETSTATE operator is used to set the state of one or multiple lines in a (grid) control to CHECKED/UNCHECKED/SELECTED/UNSELECTED. This operator can be used in a Set Values action rule in the layout.
Syntax
SETSTATE(pointer,offset,state)
-
pointer - A pointer, for instance to a control.
-
offset - The number of lines to shift by. This number indicates which line's state should be changed compared to the current line. This can also be an expression or
*. -
state - The state the line should be set to. This can be CHECKED/UNCHECKED/SELECTED/UNSELECTED.
Examples
SETSTATE(CTRL["gridControl"], 1, SELECTED)changes the state of the next line in thegridControlto SELECTED.SETSTATE(CTRL["gridControl"], -1, CHECKED)changes the state of the previous line in thegridControlto CHECKED.-
SETSTATE(CTRL["gridControl"], *, CHECKED)changes the state of all the lines in thegridControlto CHECKED. -
SETSTATE(CTRL["gridControl"], F["number"], SELECTED)changes the state of the line the number of positions specified in thenumberfield from the currently selected line in thegridControlto SELECTED. SETSTATE(M[-1].CTRL["filter-grid"], 1, SELECTED)changes the state of the "filter-grid" control in the previous menu block. It will change the selection to the next line.