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-grid
control.
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-grid
control.
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"])
returnstrue
if theordersOverview
is rendered as overlay layout.ISOVERLAYLAYOUT()
returnstrue
if the layout containing this expression is rendered as overlay layout.
SETSTATE
The SETSTATE
operator is used to set the state of a line in a (grid) control to CHECKED or SELECTED. 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.
-
state - The state the line should be set to. This can either be SELECTED or CHECKED.
Examples
SETSTATE(CTRL["gridControl"], 1, SELECTED)
changes the state of the next line in thegridControl
to SELECTED.SETSTATE(CTRL["gridControl"], -1, CHECKED)
changes the state of the previous line in thegridControl
to CHECKED.SETSTATE(CTRL["gridControl"], F["number"], SELECTED)
changes the state of the line the number of positions specified in thenumber
field from the currently selected line in thegridControl
to 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.