Null Values for Data Types
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
Microsoft Dynamics AX does not support the concept of null values that is available in many other Database Management Systems (DBMS). A field in Microsoft Dynamics AX always has a type and a value.
For each data type, however, one value is considered null (for example, when the validateField table method is executed).
Type |
Value treated as null |
---|---|
Date |
1900-01-01 |
Enum |
Element with its value set to 0. |
Integer |
0 |
Real |
0.0 |
String |
An empty string |
Time |
00:00:00 |
Any value with its date portion as 1900-01-01 is treated as null, regardless of the time portion value. Therefore the value 1900-01-01T22:33:44 is treated as null. Note Any utcDateTime value with its date portion as 1900-01-01 is displayed as blank by the X++ print statement. Only the value 1900-01-01T00:00:00 is displayed as blank by the Global::info method. That is the value from the DateTimeUtil::MinValue method. |
As a result, when the validateField method checks whether a user has entered a value in a mandatory field, 0 is not accepted in an integer type field, the first entry is not accepted in an enum type field, and so on.
Also, the values that are listed in the previous table yield false in a Boolean comparison, in X++ SQL. In non-SQL X++ statements, the equal and relational operators work with these values the same normal way that they work with other values.
Variables of type container, and classes and variables of table type can be null in the traditional DBMS sense. A table type is null if all its fields have their null value.
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.