From bc21da1f74b2ae2a881ab283108b68b51747add9 Mon Sep 17 00:00:00 2001 From: Augusto Passalacqua Date: Tue, 12 May 2026 15:00:28 +0200 Subject: [PATCH 1/5] Add documentation for the LPAD and RPAD OQL functions --- .../modeling/domain-model/oql/_index.md | 2 + .../domain-model/oql/oql-expression-syntax.md | 112 ++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/content/en/docs/refguide/modeling/domain-model/oql/_index.md b/content/en/docs/refguide/modeling/domain-model/oql/_index.md index 15b0cc0336c..2577a5155a1 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/_index.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/_index.md @@ -46,6 +46,8 @@ OQL is under constant development so some expressions and features are not avail | DATEPARSE | 11.10.0 | | DATETRUNC | 11.9.0 | | LOCATE | 11.9.0 | +| LPAD | 11.11.0 | +| RPAD | 11.11.0 | | STRING_AGG in View Entities and Datasets | 11.2.0 | | SUBSTRING | 11.9.0 | 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 afce4e213a1..9fcc6fd18ba 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 @@ -692,10 +692,12 @@ These are the currently supported functions: * LENGTH * LOCATE * LOWER +* LPAD * RANGEBEGIN * RANGEEND * REPLACE * ROUND +* RPAD * UPPER ### CAST{#cast} @@ -1329,6 +1331,61 @@ SELECT * FROM Sales.Customer WHERE LOWER(LastName) = 'doe' This query can no longer take advantage of an index for `LastName` for comparison, resulting in a performance decrease. {{% /alert %}} +### LPAD {#lpad-function} + +#### Description + +Pads a string on the left side with a specified character to reach a target length. + +{{% alert color="info" %}} +This function was introduced in Mendix version 11.11.0. +{{% /alert %}} + +#### Syntax + +```sql +LPAD ( expression , length_expression [, pad_expression ] ) +``` + +#### expression + +`expression` specifies the expression of type `string` to pad. + +#### length_expression + +`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long` + +{{% alert color="info" %}} +If `length_expression` is smaller than the length of `expression`, this function truncates it. This behavior is database specific. +{{% /alert %}} + +#### pad_expression + +`pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. + +{{% alert color="info" %}} +If `pad_expression` has more than one character, the behavior of this function is database dependent. +{{% /alert %}} + +#### Examples + +```sql +SELECT LPAD('hello', 10) AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| hello | + + +```sql +SELECT LPAD('hello', 10, 'x') AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| xxxxxhello | + ### Ranges in Datasets {{% alert color="info" %}} @@ -1507,6 +1564,61 @@ SELECT ROUND((Price : 7), 2) as RoundedPrice, Price : 7 FROM Sales.Order | 0.33 | 3.33333333 | | 1.17 | 1.17142857 | +### RPAD {#rpad-function} + +#### Description + +Pads a string on the right side with a specified character to reach a target length. + +{{% alert color="info" %}} +This function was introduced in Mendix version 11.11.0. +{{% /alert %}} + +#### Syntax + +```sql +RPAD ( expression , length_expression [, pad_expression ] ) +``` + +#### expression + +`expression` specifies the expression of type `string` to pad. + +#### length_expression + +`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long` + +{{% alert color="info" %}} +If `length_expression` is smaller than the length of `expression`, this function truncates it. +{{% /alert %}} + +#### pad_expression + +`pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. + +{{% alert color="info" %}} +If `pad_expression` has more than one character, the behavior of this function is database dependent. +{{% /alert %}} + +#### Examples + +```sql +SELECT RPAD('hello', 10) AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| hello | + + +```sql +SELECT RPAD('hello', 10, 'x') AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| helloxxxxx | + ### SUBSTRING{#substring-function} #### Description From a196c91a4d95b04b39d1723f291996c8a9dbff5f Mon Sep 17 00:00:00 2001 From: Augusto Passalacqua Date: Mon, 18 May 2026 11:47:31 +0200 Subject: [PATCH 2/5] Change introduction date for oql padding functions to 11.12 and remove pad_expression multi-character alert --- .../refguide/modeling/domain-model/oql/_index.md | 4 ++-- .../domain-model/oql/oql-expression-syntax.md | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/content/en/docs/refguide/modeling/domain-model/oql/_index.md b/content/en/docs/refguide/modeling/domain-model/oql/_index.md index 2577a5155a1..d8ce2315583 100644 --- a/content/en/docs/refguide/modeling/domain-model/oql/_index.md +++ b/content/en/docs/refguide/modeling/domain-model/oql/_index.md @@ -46,8 +46,8 @@ OQL is under constant development so some expressions and features are not avail | DATEPARSE | 11.10.0 | | DATETRUNC | 11.9.0 | | LOCATE | 11.9.0 | -| LPAD | 11.11.0 | -| RPAD | 11.11.0 | +| LPAD | 11.12.0 | +| RPAD | 11.12.0 | | STRING_AGG in View Entities and Datasets | 11.2.0 | | SUBSTRING | 11.9.0 | 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 9fcc6fd18ba..51f31bf0e1d 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 @@ -1338,7 +1338,7 @@ This query can no longer take advantage of an index for `LastName` for compariso Pads a string on the left side with a specified character to reach a target length. {{% alert color="info" %}} -This function was introduced in Mendix version 11.11.0. +This function was introduced in Mendix version 11.12.0. {{% /alert %}} #### Syntax @@ -1363,10 +1363,6 @@ If `length_expression` is smaller than the length of `expression`, this function `pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. -{{% alert color="info" %}} -If `pad_expression` has more than one character, the behavior of this function is database dependent. -{{% /alert %}} - #### Examples ```sql @@ -1571,7 +1567,7 @@ SELECT ROUND((Price : 7), 2) as RoundedPrice, Price : 7 FROM Sales.Order Pads a string on the right side with a specified character to reach a target length. {{% alert color="info" %}} -This function was introduced in Mendix version 11.11.0. +This function was introduced in Mendix version 11.12.0. {{% /alert %}} #### Syntax @@ -1596,10 +1592,6 @@ If `length_expression` is smaller than the length of `expression`, this function `pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. -{{% alert color="info" %}} -If `pad_expression` has more than one character, the behavior of this function is database dependent. -{{% /alert %}} - #### Examples ```sql From b3249c029392a08ddcab665febc3e38d68b4bb1e Mon Sep 17 00:00:00 2001 From: Augusto Passalacqua Date: Wed, 27 May 2026 15:39:02 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Add=20more=20examples=20to=20L/RPAD=20and?= =?UTF-8?q?=20use=20`=C2=B7`=20for=20the=20space=20character=20in=20exampl?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain-model/oql/oql-expression-syntax.md | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) 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 51f31bf0e1d..d209a509520 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 @@ -1371,7 +1371,9 @@ SELECT LPAD('hello', 10) AS padded FROM Sales.Order | padded | |:-----------| -| hello | +| ·····hello | + +Where `·` represents the space character. ```sql @@ -1382,6 +1384,14 @@ SELECT LPAD('hello', 10, 'x') AS padded FROM Sales.Order |:-----------| | xxxxxhello | +```sql +SELECT LPAD('hello', 10, 'abc') AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| abcabhello | + ### Ranges in Datasets {{% alert color="info" %}} @@ -1600,8 +1610,9 @@ SELECT RPAD('hello', 10) AS padded FROM Sales.Order | padded | |:-----------| -| hello | +| hello····· | +Where `·` represents the space character. ```sql SELECT RPAD('hello', 10, 'x') AS padded FROM Sales.Order @@ -1611,6 +1622,14 @@ SELECT RPAD('hello', 10, 'x') AS padded FROM Sales.Order |:-----------| | helloxxxxx | +```sql +SELECT RPAD('hello', 10, 'abc') AS padded FROM Sales.Order +``` + +| padded | +|:-----------| +| helloabcab | + ### SUBSTRING{#substring-function} #### Description From 18ced861c29e76daf91d20397e0cbde6aae378eb Mon Sep 17 00:00:00 2001 From: Augusto Passalacqua Date: Wed, 27 May 2026 15:41:23 +0200 Subject: [PATCH 4/5] Re-add info about optional parameter in padding functions --- .../modeling/domain-model/oql/oql-expression-syntax.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d209a509520..ef7656f1b44 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 @@ -1335,7 +1335,7 @@ This query can no longer take advantage of an index for `LastName` for compariso #### Description -Pads a string on the left side with a specified character to reach a target length. +Pads a string on the left side with a specified character to reach a target length. If no character is specified for padding, the space character is used. {{% alert color="info" %}} This function was introduced in Mendix version 11.12.0. @@ -1574,7 +1574,7 @@ SELECT ROUND((Price : 7), 2) as RoundedPrice, Price : 7 FROM Sales.Order #### Description -Pads a string on the right side with a specified character to reach a target length. +Pads a string on the right side with a specified character to reach a target length. If no character is specified for padding, the space character is used. {{% alert color="info" %}} This function was introduced in Mendix version 11.12.0. From 237e22049c30c3c8a4cdb9a5a5f8cbe84e6c1356 Mon Sep 17 00:00:00 2001 From: Augusto Passalacqua Date: Thu, 28 May 2026 10:41:52 +0200 Subject: [PATCH 5/5] Add null/empty values specifications to oql padding functions --- .../domain-model/oql/oql-expression-syntax.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 ef7656f1b44..73536a539fb 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 @@ -1350,10 +1350,13 @@ LPAD ( expression , length_expression [, pad_expression ] ) #### expression `expression` specifies the expression of type `string` to pad. +This function returns `NULL` if `expression` is `NULL`. +The behavior for the empty string is database specific. #### length_expression -`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long` +`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long`. +This function returns `NULL` if `length_expression` is `NULL`. {{% alert color="info" %}} If `length_expression` is smaller than the length of `expression`, this function truncates it. This behavior is database specific. @@ -1362,6 +1365,7 @@ If `length_expression` is smaller than the length of `expression`, this function #### pad_expression `pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. +If `pad_expression` is `NULL` or the empty string, the behavior is database specific. #### Examples @@ -1589,10 +1593,13 @@ RPAD ( expression , length_expression [, pad_expression ] ) #### expression `expression` specifies the expression of type `string` to pad. +This function returns `NULL` if `expression` is `NULL`. +The behavior for the empty string is database specific. #### length_expression -`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long` +`length_expression` specifies the length of the resulting string. The expression must be of type `integer` or `long`. +This function returns `NULL` if `length_expression` is `NULL`. {{% alert color="info" %}} If `length_expression` is smaller than the length of `expression`, this function truncates it. @@ -1601,6 +1608,7 @@ If `length_expression` is smaller than the length of `expression`, this function #### pad_expression `pad_expression` is an optional parameter that specifies the character or string to pad with. If not specified, the space character is used. +If `pad_expression` is `NULL` or the empty string, the behavior is database specific. #### Examples