Skip to content

Commit 7fca586

Browse files
authored
Merge pull request #11058 from passalaqua/dat/feature/trim
Documentation for TRIM, RTRIM and LTRIM OQL functions
2 parents 5a7247b + a424f89 commit 7fca586

3 files changed

Lines changed: 130 additions & 1 deletion

File tree

content/en/docs/refguide/installation/system-requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ Current support:
243243

244244
* [MariaDB](/refguide/mysql/): 10.6, 10.11, 11.4, 11.8
245245
* [Microsoft SQL Server](/developerportal/deploy/mendix-on-windows-microsoft-sql-server/): 2022, 2025
246-
* [Azure SQL](https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level?view=sql-server-2017): v12 compatibility mode 140 or higher
246+
* [Azure SQL](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level?view=sql-server-ver17): v12 compatibility mode 160 or higher
247247
* [MySQL](/refguide/mysql/): 8.4
248248
* [Oracle Database](/refguide/oracle/): 19, 21c, 23ai (including 26ai)
249249
* PostgreSQL: 13, 14, 15, 16, 17, 18

content/en/docs/refguide/modeling/domain-model/oql/_index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,11 @@ OQL is under constant development so some expressions and features are not avail
4646
| DATEPARSE | 11.10.0 |
4747
| DATETRUNC | 11.9.0 |
4848
| LOCATE | 11.9.0 |
49+
| LTRIM | 11.11.0 |
50+
| RTRIM | 11.11.0 |
4951
| STRING_AGG in View Entities and Datasets | 11.2.0 |
5052
| SUBSTRING | 11.9.0 |
53+
| TRIM | 11.11.0 |
5154

5255
### [OQL Statements](/refguide/oql-statements/){#statement-versions}
5356

content/en/docs/refguide/modeling/domain-model/oql/oql-expression-syntax.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,10 +692,13 @@ These are the currently supported functions:
692692
* LENGTH
693693
* LOCATE
694694
* LOWER
695+
* LTRIM
695696
* RANGEBEGIN
696697
* RANGEEND
697698
* REPLACE
698699
* ROUND
700+
* RTRIM
701+
* TRIM
699702
* UPPER
700703

701704
### CAST{#cast}
@@ -1329,6 +1332,47 @@ SELECT * FROM Sales.Customer WHERE LOWER(LastName) = 'doe'
13291332
This query can no longer take advantage of an index for `LastName` for comparison, resulting in a performance decrease.
13301333
{{% /alert %}}
13311334

1335+
### LTRIM{#ltrim}
1336+
1337+
Removes one or more leading characters from a `string`. If no character is specified for trimming, space is used.
1338+
1339+
{{% alert color="info" %}}
1340+
This function was introduced in Mendix version 11.11.0.
1341+
{{% /alert %}}
1342+
1343+
#### Syntax
1344+
1345+
The syntax is as follows:
1346+
1347+
```sql
1348+
LTRIM ( expression [, character ] )
1349+
```
1350+
1351+
##### expression
1352+
1353+
`expression` is any string expression to be trimmed. If `expression` is `NULL`, the function will return `NULL`.
1354+
1355+
##### character
1356+
1357+
`character` is an optional single character string expression containing the character to remove from the start of the string. If omitted, the space character is used instead.
1358+
1359+
{{% alert color="info" %}}
1360+
Only a single character is supported. `character` parameters with more than one character may not work in all supported databases.
1361+
{{% /alert %}}
1362+
1363+
If the expression string consists entirely of `character`, everything will be trimmed and the function will return a zero-length string.
1364+
1365+
#### Examples
1366+
1367+
```sql
1368+
SELECT LTRIM(LastName, 'D') FROM Sales.Order WHERE Price = 1.50000001
1369+
```
1370+
1371+
| LastName |
1372+
|:---------|
1373+
| oe |
1374+
| Moose |
1375+
13321376
### Ranges in Datasets
13331377

13341378
{{% alert color="info" %}}
@@ -1507,6 +1551,47 @@ SELECT ROUND((Price : 7), 2) as RoundedPrice, Price : 7 FROM Sales.Order
15071551
| 0.33 | 3.33333333 |
15081552
| 1.17 | 1.17142857 |
15091553

1554+
### RTRIM{#rtrim}
1555+
1556+
Removes one or more trailing characters from a `string`. If no `character` is specified for trimming, space is used.
1557+
1558+
{{% alert color="info" %}}
1559+
This function was introduced in Mendix version 11.11.0.
1560+
{{% /alert %}}
1561+
1562+
#### Syntax
1563+
1564+
The syntax is as follows:
1565+
1566+
```sql
1567+
RTRIM ( expression [, character ] )
1568+
```
1569+
1570+
##### expression
1571+
1572+
`expression` is any string expression to be trimmed. If `expression` is `NULL`, the function will return `NULL`.
1573+
1574+
##### character
1575+
1576+
`character` is an optional single character string expression containing the character to remove from the end of the string. If omitted, the space character is used instead.
1577+
1578+
{{% alert color="info" %}}
1579+
Only a single character is supported. `character` parameters with more than one character may not work in all supported databases.
1580+
{{% /alert %}}
1581+
1582+
If the expression string consists entirely of `character`, everything will be trimmed and the function will return a zero-length string.
1583+
1584+
#### Examples
1585+
1586+
```sql
1587+
SELECT RTRIM(LastName, 'e') FROM Sales.Order WHERE Price = 1.50000001
1588+
```
1589+
1590+
| LastName |
1591+
|:---------|
1592+
| Do |
1593+
| Moos |
1594+
15101595
### SUBSTRING{#substring-function}
15111596

15121597
#### Description
@@ -1559,6 +1644,47 @@ ORDER BY LastName LIMIT 1
15591644
|:-------------|:---------------|:----------------|:-----------------|
15601645
| logical | logic | logical | *(empty string)* |
15611646

1647+
### TRIM{#trim}
1648+
1649+
Removes one or more leading and trailing characters from a `string`. If no `character` is specified for trimming, space is used.
1650+
1651+
{{% alert color="info" %}}
1652+
This function was introduced in Mendix version 11.11.0.
1653+
{{% /alert %}}
1654+
1655+
#### Syntax
1656+
1657+
The syntax is as follows:
1658+
1659+
```sql
1660+
TRIM ( expression [, character ] )
1661+
```
1662+
1663+
##### expression
1664+
1665+
`expression` is any string expression to be trimmed. If `expression` is `NULL`, the function will return `NULL`.
1666+
1667+
##### character
1668+
1669+
`character` is an optional single character string expression containing the character which will be removed from the beginning and end of the string. If omitted, the space character is used.
1670+
1671+
{{% alert color="info" %}}
1672+
Only a single character is supported. `character` parameters with more than one character may not work in all supported databases.
1673+
{{% /alert %}}
1674+
1675+
If the expression string consists entirely of `character`, everything will be trimmed and the function will return a zero-length string.
1676+
1677+
#### Examples
1678+
1679+
```sql
1680+
SELECT TRIM(TRIM(LastName, 'e'), 'D') FROM Sales.Order WHERE Price = 1.50000001
1681+
```
1682+
1683+
| LastName |
1684+
|:---------|
1685+
| o |
1686+
| Moos |
1687+
15621688
### UPPER
15631689

15641690
Converts all lowercase characters in a given string to uppercase. Opposite of [LOWER](#lower-function).

0 commit comments

Comments
 (0)