Extended data types and element properties
X++ data types are divided into primitive data types and composite data types. In the AOT, you can create EDTs and base enums that build on the primitive data types. The basic set of primitive data types in the system maps to underlying data types that exist in the physical database. These primitive data types can be expanded to create EDTs.
By design, finance and operations apps have a limited number of primitive data types. This limitation significantly reduces the number of data type conversions, improves data integrity, and creates a programming language that is simpler to use.
The following primitive data types exist in the AOT and can be created in Visual Studio:
- Booleans - Can only contain the values "false" and "true."
- Dates - Contain the numbers for day, month, and year.
- Enums - An abbreviation for "enumerated text," or a set of literals.
- GUIDs - Globally unique identifiers.
- Integers - Numbers without a decimal point.
- Real - Numbers with a decimal point and are sometimes called decimals.
- String - A series of characters, such as a text block.
- TimeofDay - Contain the numbers for hour, minute, and second.
- UTCDateTime - Contain the numbers for year, month, day, hour, minute, and second.
Benefits of using EDTs
We recommend that you use EDTs in development for many reasons.
Code is easier to read when you are using EDTs because the variables are named in a meaningful way. For example, you can declare a string variable to be called "Name" for a field where you want a user to enter a name in the user interface.
The properties that you set for an EDT are used by all instances of that type, which reduces work and promotes consistency. For example, account numbers (AccountNum data type) have the same properties throughout the system.
You can create hierarchies of EDTs, which inherit the properties that are appropriate from the parent and change the other properties. For example, the ItemCode EDT is used as the basis for the MarkupItemCode and PriceDiscItemCode EDTs. In the Properties window, if you leave the display length and style set to Auto for an EDT, finance and operations apps will make the best choice for how the EDT is displayed. This will make the EDT flexible throughout the system.
Most fields in the tables of finance and operations apps are based on EDTs. After the EDT is created, it can be reused as many times as it is needed in the application.
EDTs have various behaviors that you can use in your development. For example, EDTs can help enable lookup behavior on controls. You can also enable these controls to have drop-down lists and lookup capabilities for multiline string controls. To learn more about this capability, see Lookup controls.