$value.toBoolean()
Converts a value to a boolean. This conversion usually happens automatically when a value is used in a context where a boolean is expected, e.g. in a condition like $value.ifElse(true, false). The explicit conversion may be necessary if a boolean value is to be stored in an attribute of a model element.
The result is calculated as follows:
false, if value is false, null, or empty,true for all other cases| Name | Type | Description | Mandatory | Default |
|---|---|---|---|---|
| value | Number/string/boolean/Business object/set | A value to be converted to a boolean. | yes |
Type: Boolean
The converted value.
false.toBoolean()
Output: false
date(2021, 5, 8).toBoolean()
Output: true
Since the date value is neither null, empty, nor false, this results in true.
null.toBoolean()
Output: false
list().toBoolean()
Output: false
Since the list is empty, this results in false.