{"title":"Relational operators","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/devenv-al-relational-operators/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-al-relational-operators, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-al-relational-operators","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Description of the relational operators in AL and how they are used to compare expressions, as well as valid uses of relational operators.","date":"2024-04-26","meta":{"topic":"concept-article"},"outline":[{"level":2,"title":"Evaluation rules for relational operators","slug":"evaluation-rules-for-relational-operators","at":64,"chars":2002},{"level":3,"title":"Valid uses of relational operators","slug":"valid-uses-of-relational-operators","at":956,"chars":1110},{"level":2,"title":"Related information","slug":"related-information","at":2066,"chars":101}],"text":"The relational operators in AL are used to compare expressions.\n## Evaluation rules for relational operators\nThe following table defines the evaluation rules for relational operators. The rules assume that the data types of the expressions can be compared. For a complete overview of comparable data types, refer to the section #valid-uses-of-relational-operators.\nOperator|Operator name|Expression|Resulting date type\n`>`|Greater than|`Expr > Expr`|Boolean\n`<`|Less than|`Expr < Expr`|Boolean\n`>=`|Greater than or equal|`Expr >= Expr`|Boolean\n`<=`|Less than or equal|`Expr <= Expr`|Boolean\n`<>`|Not equal to|`Expr <> Expr`|Boolean\n`=`|Equal to|`Expr = Expr`|Boolean\nin|In range|`Expr in [Valueset]`|Boolean\n> NOTE\n> When using relational operators, uppercase and lowercase letters in strings are significant. Furthermore, the comparison is based on the built-in character comparison table of the system, that is, not by comparing \"true\" ASCII characters.\n### Valid uses of relational operators\nThe following table describes the valid uses of the relational operators and the data types that result when expressions are evaluated. The non-valid combinations of types for relational operators are indicated by a dash. All relational operators are binary infix operators; that is, they take a left and a right argument and are placed between the arguments.\nThe rows in the table show the type of the left argument and the columns show the type of the right argument. The cells show the resulting data type.\nA valid use of the relational operators is, for example, text compared with text or code, while boolean can't be compared with anything other than boolean, and so on.\n|Relational operator|Boolean|Char|Option|Integer|Decimal|Date|Time|Text|Code|\n|Boolean|Boolean|||||||||\n|Char||Boolean|Boolean|Boolean|Boolean|||||\n|Option||Boolean|Boolean|Boolean|Boolean|||||\n|Integer||Boolean|Boolean|Boolean|Boolean|||||\n|Decimal||Boolean|Boolean|Boolean|Boolean|||||\n|Date||||||Boolean||||\n|Time|||||||Boolean|||\n|Text||||||||Boolean|Boolean|\n|Code||||||||Boolean|Boolean|\n## Related information\ndevenv-al-operators\ndevenv-al-arithmetic-operators\ndevenv-al-boolean-operators"}