X++ Keywords
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
The X++ keywords shown in the following table are reserved. These keywords cannot be used for any other purpose.
Reserved word |
Description |
More information |
---|---|---|
! |
Not. |
|
!= |
Inequality operator (not equal to). |
|
# |
Prefix on macro names. |
|
& |
Binary AND. |
|
&& |
Logical AND. |
|
( |
Function call operator, which indicates the beginning of the function call. |
|
) |
Function call operator, which indicates the end of the function call. |
|
* |
Multiply. The asterisk (*) is also used in X++ SQL. One use is to signify all fields from the tables on a select statement. Another use is as a wildcard with the like operator, to signify 0 to many characters of any kind. The like operator also uses the ? character. |
|
^ |
Binary XOR. |
|
| |
Binary OR. |
|
|| |
Logical OR. |
|
~ |
Not. |
|
+ |
Plus. |
|
++ |
Increment. |
|
+= |
Additive assignment. |
|
, |
Comma operator. Expressions separated by commas are evaluated left-to-right. |
|
- |
Minus. |
|
-- |
Decrement operator. |
|
-= |
Subtractive assignment. |
|
. |
Class member access operator, for example, formRun.run accesses the run method of an object of the class type FormRun. |
|
/ |
Divide. |
|
\ |
Escape in strings. Escapes extra quotation marks, and certain letters such as \t for tab. |
|
@ |
Escape of keywords. For example, str @abstract; would fail to compile without the @ sign. Also affects literal strings, by negating the effect of the \ escape character, and by enabling the string to span more than one line in the source code. The new line is represented by one character of hexadecimal 0x0A, which is commonly called a line feed. No carriage return character of hexadecimal 0x0D is included, as in 0x0D0A. |
|
: |
Field declaration or label specifier. The colon (:) character is also used on the switch statement. |
|
:: |
Used to call static (class) methods: ClassName::methodName. |
|
; |
Terminates statements. Used in for loops or as a separator of statements. |
|
< |
Less than. |
|
<< |
Left shift. |
|
<= |
Less than or equal. |
|
= |
Assignment operator. The argument to the left of "=" is set to the value of the argument to the right. |
|
== |
Returns true if both expressions are equal. |
|
> |
Greater than. |
|
>= |
Greater than or equal. |
|
>> |
Right shift. |
|
? |
Ternary operator. The question mark (?) character is also used by the like operator to signify exactly one character of any kind. The like operator also uses the * character. |
|
[ |
Array declarator, open. Must be used with "]". |
|
] |
Array declarator, close. Must be used with "[". |
|
{ |
Indicates the beginning of a number of statements. The last of these statements must be followed by a "}". |
|
} |
Indicates the end of a number of statements. A "{" must appear before the first of these statements. |
|
abstract |
Class and method modifier. An abstract class cannot be constructed with the new keyword. An abstract method cannot be called. A table can also be modified as abstract by setting its Abstract property to Yes in the AOT, or by using the DictTable class. The Abstract property defaults to No, and it cannot be set unless the table is extended by another table. Each row in an abstract table must have a dependent row in a derived table. This means that each row in an abstract table has a value greater than 0 (zero) in its InstanceRelationType property field. There are no other effects from marking a table as abstract. Informally, programmers often use the term concrete to describe a class that is non-abstract. |
|
anytype |
The method can return any data type. |
|
as |
Needed when you assign a base class variable to a derived class variable. For example, given a Derived class that extends a Base class, the statement myDerived = myBase as Derived; avoids a compiler error by using the as keyword. This keyword also applies when you assign a base table variable to a derived table variable. |
|
asc |
An option on the order by or group by clause in a select statement. The sorting is ascending. |
|
at |
Specifies the position of a print window. |
|
avg |
Returns the average of the fields from the rows specified by the group by clause in a select statement. |
|
break |
Immediate exit from code block. |
|
breakpoint |
Represents a breakpoint that is set for debugging purposes. To set a breakpoint in your code, write: breakpoint; |
|
by |
||
byref |
Specifies that the parameter being passed to the called method is being passed by reference (address), instead of by value. Byref is used in X++ when calling a .NET method that takes a parameter by reference (such as with the C# keywords out or ref). |
|
case |
Selection within a switch statement. |
|
catch |
Used in exception handling. |
|
changeCompany |
Changes database settings to another company. |
|
class |
Declares a class. |
|
client |
Method modifier. |
|
container |
Specifies a variable of type container. |
|
continue |
Forces the next iteration of a loop. |
|
count |
Returns the number of records from the rows specified by the group by clause in a select statement. |
|
crossCompany |
Causes a select statement to return data for all companies that the user is authorized to read from. |
|
date |
Specifies a variable of type date. |
|
default |
Default case within switch statements. |
|
delegate |
A class member that is able to store multiple references to methods in other classes, and to call all those methods when prompted to do so. A delegate can store references to various kinds of methods including the following:
|
|
delete_from |
Allows you to delete multiple records from the database at the same time. |
|
desc |
An option on the order by or group by clause in a select statement. The sorting is descending. |
|
display |
Method modifier. |
|
div |
Integer division. |
|
do |
Beginning of a do...while loop. |
|
edit |
Method modifier. |
|
else |
Conditional execution (if...else). |
|
eventHandler |
Must be used each time you either add or delete a method reference from a delegate by using the += or -= operator. For example: myDelegate += eventHandler(OtherClass::myStaticMethod); |
|
exists |
Used with join clauses in select statements. |
|
extends |
A class or interface declaration clause. If your class does not explicitly extend another class, your class is considered to extend the Object class (as if you had written "extends Object"). |
|
false |
Boolean literal. |
|
final |
Class and method modifier. |
|
firstFast |
Used in select statements to speed up the fetch for the first row. |
|
firstOnly |
Used in select statements to fetch only the first record. The firstOnly keyword does not guarantee that a maximum of one record is retrieved by an X++ SQL select statement. If the AOS can use the EntireTable cache to satisfy the data demands of the select statement, the firstOnly keyword is ignored. |
|
firstOnly10 |
Same as firstOnly, except returns 10 rows instead of one. |
|
firstOnly100 |
Same as firstOnly, except returns 100 rows instead of one. |
|
firstOnly1000 |
Same as firstOnly, except returns 1000 rows instead of one. |
|
flush |
Clears an entire table cache. Here is the syntax for the flush statement:
|
|
for |
For loop iteration. |
|
forceLiterals |
Used in select statements to reveal actual values that are used in where clauses to the Microsoft SQL Server database at the time of optimization. |
|
forceNestedLoop |
Forces the SQL Server database to use a nested-loop algorithm to process a particular SQL statement containing a join. |
|
forcePlaceholders |
Used in select statements to instruct the kernel not to reveal the actual values used in where clauses to the Microsoft SQL Server database at the time of optimization. |
|
forceSelectOrder |
Forces the SQL Server database to access the tables in a join in the specified order. |
|
forUpdate |
Selects records exclusively for update. The operation to be performed on the records that are fetched is an update. Depending on the underlying database, the records may be locked for other users. |
|
from |
Part of a select statement. The from clause specifies the table in which the columns exists. |
|
group |
Part of the group by clause in a select statement. |
|
if |
Conditional execution. |
|
implements |
Implements an interface. |
|
insert_recordset |
Copies data from one or more tables into one resulting destination table on a single server trip. |
|
int |
Specifies a variable of type integer (32-bit). |
|
int64 |
Specifies a variable of type integer (64-bit). |
|
interface |
Interface declaration. |
|
is |
Asks whether the object referenced by a class variable either inherits from the given class or is of the given class. For example, given a Derived class that extends a Base class, the expression (myDerived is Base) returns true. This keyword applies to class inheritance and table inheritance. |
|
join |
Tables are joined on columns common to both tables. You can generate a single result set based on multiple tables through the use of joins. |
|
like |
Tests for matches by pattern, with wildcard symbols * and ?. The string on the right side of the like operator must use four backslash characters to represent one backslash. Examples follow:
|
|
maxof |
Returns the maximum of the fields from the rows specified by the group by clause. |
|
minof |
Returns the minimum of the fields from the rows specified by the group by clause. |
|
mod |
Returns the integer remainder of the left expression1 divided by the right expression2. Informally this is sometimes called the modulo operator. ((12 mod 7) == 5) is true. |
|
new |
Operator. Creates an instance of an anonymous class that is assignment-compatible with the named class/interface reference variables, or allocates memory for an array. |
|
next |
Fetches the next record in a table. |
|
noFetch |
Indicates that no records are to be fetched at present. |
|
notExists |
Used with join clauses in select statements. |
|
null |
Symbolic constant. |
|
optimisticLock |
Forces a statement to run with optimistic concurrency control, even if a different value is set on the table. |
|
order |
Part of the order by clause in a select statement. |
|
outer |
outer join. |
|
pause |
Halts the execution of a job. The user is asked to state whether execution should continue. |
|
pessimisticLock |
Forces a statement to run with pessimistic concurrency control, even if a different value is set on the table. |
|
Allows you to display output on the screen. |
||
private |
Method access modifier. |
|
protected |
Method access modifier. |
|
public |
Method access modifier. |
|
real |
Specifies a variable of type real. |
|
repeatableRead |
Specifies that no other transactions can modify data that has been read by logic inside the current transaction, until after the current transaction completes. An explicit transaction completes at either ttsAbort or at the outermost ttsCommit. For a stand-alone select statement, the transaction duration is the duration of the select command. However, the database sometimes enforces the equivalent of repeatableRead in individual select statements even without this keyword appearing in your X++ code (depending on how the database decides to scan the tables). |
For more information, see the documentation for the underlying relational database product. |
retry |
Used in exception handling. |
|
return |
Exits from a method. |
|
reverse |
Records are returned in reverse order. |
|
select |
The select clause designates which columns or views are shown in the result set. |
|
server |
Method modifier. |
|
setting |
Used with the update_recordset command. |
|
static |
Static methods may not refer to instance variables (only to static variables); may be invoked by using the class name rather than on an instance of the class ("MyClass.aStaticProcedure"). |
|
str |
Specifies a variable of type string. |
|
sum |
Returns the sum of the fields from the rows specified by the group by clause in a select statement. |
|
super |
Calls the method that was overridden by the current method. |
|
switch |
Switch selection statement. |
|
tableLock |
Obsolete; tableLock is no longer available. |
|
this |
A reference to the current instance of the class.
|
Loosely similar to the system variable that is named element. You use element in form control methods to reference the containing form. For more information, see Using Variables with Forms. |
throw |
Used in exception handling. |
|
true |
Boolean literal. |
|
try |
Used in exception handling. |
|
ttsAbort |
Discards all changes in the current transaction. |
|
ttsBegin |
Marks the beginning of a transaction. |
|
ttsCommit |
Marks the end of a transaction. |
|
update_recordset |
Allows the manipulation of row sets within one operation. |
|
validTimeState |
Filters rows that are retrieved from a valid time state table by an X++ SQL select statement. For example: |
Effects of Valid Time State Tables on Read and Write Operations |
void |
Identifies a method that does not return a value. |
|
where |
Part of a select statement. The where clause specifies the conditions to be satisfied; that is, the rows that you want to include in the result. |
|
while |
Iteration statement. Executes a statement or block repeatedly when a test condition is true. |
|
window |
Allows you to alter the size of the output window. |
See also
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.