Primitive Data Types in X++ Programming Language
Table of Content:
Gain insights into primitive data types in the X++ programming language. Explore the fundamental data types that form the building blocks of X++ code, enhancing your proficiency in data manipulation and programming.
The primitive data types in X++ are listed in the following table.
Anytype |
A placeholder for any data type. |
Booleans |
Can only contain the values false and true. |
Dates |
Contains day, month, and year. |
Enums |
An abbreviation for enumerated text—a set of literals. |
GUIDs |
A globally unique identifier. |
Integers |
A number without a decimal point. To declare an integer, use the keyword int. |
Reals |
Numbers with a decimal point; also called decimals. |
Strings |
A number of characters. To declare a string, use the keyword str. |
TimeOfDay |
Contains hours, minutes, and seconds. To declare a time, use the system type timeOfDay. |
utcdatetime |
Contains year, month, day, hour, minute and second. |
Note; Always use Extended data Types. It's not best practice to use Primitive Data Types in real world project.
Code
boolean boolVal = true; date dateVal = systemDateGet(); utcdatetime dateTimeVal = DateTimeUtil::getSystemDateTime(); guid guidVal = newguid(); int intVal = -345678; int64 int64Val = -234567895432; str strVal = "Hello"; real realVal = 3.14;
EDT
//Address --> City - 60 characters Atnylacity city = "Hyderabad"; AtnylaGenericDate dateValu = systemDateGet(); AtnylaAmount realValu= 3.14; var varVal = 123; anytype anyVal = boolVal; anyVal = guidVal; anyVal int64Val; anyVal = dateTimeVal;