Expression binding is an enhancement of the SAPUI5 binding syntax, which allows for providing expressions instead of formatter functions.
Using expression binding saves the overhead of defining a function and is recommended if the formatter function has a trivial implementation like a comparison of values.
To use expression binding, you need to enable complex binding syntax for the application.
Note

An expression binding is specified in an XML view by one of the following two options:
- {= expression}
This variant uses one-way binding. This allows the automatic recalculation if the model values change.
- {:= expression}
This variant uses one-time binding, meaning that the value is calculated only once. This variant needs less resources because no change listeners to the model have to be maintained.
The syntax of the expression is similar to JavaScript syntax, but you can only use a subset of the JavaScript expression syntax. Among others, the following syntax elements are available:
- Strict equality operators:
===, !==
- Relational operators:
<, >, <=, >=
- Conditional operator:
?
- Binary logical operators:
&&, ||
- Global symbols:
For example, undefined
Additionally, you can embed values from the model layer into an expression by using the following syntax:
1${binding}binding can either be a simple path, or a complex binding.
For embedded bindings with standard data types such as String, members and member methods can be accessed with the . operator as in the following example:
1${/CustomerName}.lengthNote
Examples of expression binding can be found in the figure Using Expression Binding.


