Issue
After adding a view entity to the domain model, the Mendix application throws a runtime error during data retrieval.
com.mendix.connectionbus.ConnectionBusRuntimeException: Illegal Expression Modulename$Entity/Attribute. Unary Operations are only allowed for Boolean values.The full stack trace indicates the error occurs during data retrieval operations and references com.mendix.webui.WebUIException: Exception while retrieving data.
Environment
Studio Pro (all versions)
Cause
The error occurs when an OQL expression in a view entity uses an operator or function that is restricted to Boolean values, but is being applied to a non-Boolean attribute (such as an ID field). The specific error message Illegal Expression indicates that the OQL syntax in the view entity definition contains an invalid operation for the data type being used.
In OQL, certain operators like AND, OR, and NOT are only allowed for Boolean expressions. When these operators are incorrectly applied to other data types (such as Long, String, or Integer), the runtime throws this error.
Solution/Workaround
To resolve this issue, review and correct the OQL expression in the view entity definition using the following steps:
Open the view entity in the domain model that was recently added or modified
Review the OQL query definition, paying particular attention to any expressions involving ID fields or non-Boolean attributes
Identify any Boolean operators (
AND,OR,NOT) that are being applied to non-Boolean values-
Correct the OQL expression to use appropriate operators for the data type. For example:
Use comparison operators (
=,!=,>,<) for numeric valuesEnsure Boolean operators are only used in WHERE clauses with Boolean expressions
Save the changes and redeploy the application
Test the data retrieval operation to confirm the error is resolved
For more information about OQL syntax and valid expressions, test OQL queries in the OQL playground before implementing them in the domain model
Internal information related
#256029
Additional information
- Mendix documentation:
0 Comments