1. Anytype Data Type:
Anytype is a placeholder for any data types (integer, real, string, container, class, etc.).Please refer this link for more information.
2. Booleans
We can use Boolean for true or false values.3. Dates
Dates data type is used to handle date value (date, month, year).Assign value:
date d1 = 31\3\2015;
We can add days and subtract date easily. For example:
date d1 = 31\3\2015;
d1 = d1 + 3; //Add two day, result: Apr 3, 2015
d1 = d1 - 1; //Subtract one day, Result Apr 2, 2015
Date range is Jan 1, 1900 to Dec 31, 2154
4. Enums
Enum is an abbreviation of enumerated text. It contains list of literals. Enum literals represented as integer values. First Enum literal value is 0, next literal value is 1 and so on. We can use maximum 251 literals in single Enum.We can create Enum in the AOT -> Base Enums. We can declare this Enum in X++ like other data types (ex: Integer)
Declaration:
NoYes isCompleted;
Assign value:
isCompleted = NoYes::Yes;
If you assign this Enum data type EDT in the combo box, the Enum literals are coming as combo box options.
Enums as Radio button
If you drag the form data source enum field in the design, the combo box control will be added (combo box is default control for enums). If you want radio button (radiobutton) control instead of combo box, add the radio button control by right click on design node and go to New Control -> RadioButton. Set the data source and data field property of the radio button.
If you want to set Enums in the un bound radio button control, select the Enum Type or use ExtendedDataType properties.
5. GUIDS
GUID is a Globally Unique Identifier. It is a unique no across all computers and networks. The unique identifier is generated by Microsoft algorithm. We can use this data type if we need globally unique no.Hint: To check the GUID empty value, we can use the nullValueBaseType Global class method.
Example:
if(this.PurchReqLineRefId == nullValueBaseType(Types::Guid))
6. Integers
It is a number without decimal point.Two integer types are there:
int (32 bit)
int64 (64 bit)
int range is - 2,147,483,648 to 2,147,483,647
int64 range is - 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Declaration:
int a = 27;
7. Reals
Real data type is used to hold decimal numbers.Declaration:
real r1 = 10.03;
8. Strings
It is used for strings (number of characters). Range is unlimited.We can set the length in the StringSize property of the EDT or table field. In X++, we can set maximum length in the declaration section. For example:
str 60 testStr;
As per the above declaration code, we can assign only 60 characters.
9. TimeOfDay
TimeOfDay datatype variable is used to hold time of the day. It represents integer value. Its range is 0 to 86400 (86400 means 23:59:59).TimeOfDay t1 = 28800;
info(strFmt('%1', time2str(t1, TimeSeparator::Colon, TimeFormat::AMPM)));
Result: 08:00:00 am
time2str function is used to display the time in the specify format.
10. UtcDateTime
UtcDateTime variable is used to hold date and time value.Assign value:
utcdatetime myUtc2 = 1988-07-20T13:34:45;
ReplyDeleteThis information is really awesome thanks for sharing most valuable information.
Microsoft Dynamics AX Technical Training
Microsoft Dynamics AX Technical Training in Hyderabad
MS Dynamics Technical Online Training
MS Dynamics AX Technical Training in Hyderabad
MS Dynamics AX Online Training
D365 AX Online Training