From 2eb0aece9de868db5728d8e80215720674a3896d Mon Sep 17 00:00:00 2001 From: Pavel Antoshin Date: Wed, 15 Jul 2026 13:59:28 +0200 Subject: [PATCH] Mention constants and enums in docs for OQL --- .../domain-model/oql/oql-expression-syntax.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md b/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md index e33a0737418..f931b7f973b 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md @@ -120,6 +120,36 @@ FROM Sales.Person ``` +## Constants {#oql-constants} + +{{% alert color="info" %}} +This feature was introduced in Mendix version 11.13.0. It is supported only in Java actions. +{{% /alert %}} + +[Constants](/refguide/constants/) can be referenced in OQL queries and statements as `$.`. For example, if a constant `Sales.MinOrder` is defined in the module, that constant can be used in a query: + +```sql +SELECT * +FROM Sales.Order +WHERE Price >= $Sales.MinOrder +``` + +## Enumerations {#oql-enumerations} + +{{% alert color="info" %}} +This feature was introduced in Mendix version 11.13.0. It is supported only in Java actions. +{{% /alert %}} + +[Enumerations](/refguide/enumerations/) can be referenced in OQL queries and statements as `.#`. That syntax is equivalent to using a String literal value of the enumeration, but it allows more strict control over which values are allowed. + +For example, if an enumeration `RealEstate.PropertyTypes` has value `Apartment`, that value can be used in a query: + +```sql +SELECT * +FROM RealEstate.Properties +WHERE PropertyType = RealEstate.PropertyTypes#Apartment +``` + ## Operators {#oql-operators} Operators perform common operations and, unlike functions, do not put their parameters in parentheses. They take `expression` as input, which can be other operator results, functions, columns and literals.