The relational operators are frequently used in conditional statements and the where clause of data manipulation statements. Other operators could be found in Arithmetic and Assignment Operators.
like
This operator compares two expressions with wildcards. It is used to evaluate the pattern of an expression. You use * as a wildcard for zero or more characters. The wildcard ? will represents any single character. This is similar to the Criteria Format discussed in Filtering Record in Dynamics Ax.
This operator returns true if the expression on the left matches the pattern supplied on the right. Otherwise, it returns false.
Syntax
expression like pattern
Example
str sExp = "Dynamics Ax associate";
;
print sExp like "*nam??s*ate"; // Output 1 - True
pause;
== (equal)
This operator compares two expressions for difference. It returns true if they are identical and false if they are different.
Syntax
expression1 == expression2
Example
str sExp = "Dynamics Ax associate";
;
print sExp == "*nam??s*ate"; // Output 0 - False
pause;
!= (not equal)
This operator is the opposite of the equal operator. It also compares two expressions for difference. However, it returns true if they are different and false if they are identical.
Syntax
expression1 != expression2
Example
str sExp = "Dynamics Ax associate";
;
print sExp != "*nam??s*ate"; // Output 1 - True
pause;
>=
This operator returns true if expression on the left is greater than or equal to expression on the right.
Syntax
expression1 >= expression2
Example
str sExp = "Dynamics Ax associate";
;
print sExp >= "Dynamics Ax"; // Output 1 - True
pause;
<=
This operator returns true if expression on the left is less than or equal to expression on the right.
Syntax
expression1 <= expression2
Example
str sExp = "Dynamics Ax associate";
;
print sExp <= "Dynamics Ax"; // Output 0 - False
pause;
>
This operator returns true if expression on the left is greater than the expression on the right.
Syntax
expression1 > expression2
Example
int nVar = 30;
;
print nVar > 30; // Output 0 - False
pause;
<
This operator returns true if expression on the left is less than the expression on the right.
Syntax
expression1 < expression2
Example
int nVar = 30;
;
print nVar < 30; // Output 0 - False
pause;
&& (AND)
This operator returns true if both expressions beside the operator is true. It returns false if either of the expression or both expressions are false.
Syntax
expression1 && expression2
|| (OR)
This operator returns true if either of the expressions beside the operator is true as well as when both of the expressions are true. It returns false only if both of the expression are false.
Syntax
expression1 || expression2
! (Not)
This operator takes one expression on its right. It negates the expression on its right. In other words, it returns false if the expression is true and returns true if the expression is false.
Syntax
! expression
0 comment :
Add your opinion