Create tables and table fields

Completed

Tables contain rows and columns, just like a spreadsheet. They are stored in a database and work together to deliver data to the user in outputs such as forms and reports. Tables can also contain metadata, which is descriptive data such as system settings. Developers can modify existing table properties and components through extensions, or they can create new tables.

Tables are made up of fields, which are organized into field groups. An index can be created from fields within a table, and aids in data retrieval. When data in one table is connected to another table, such as customer information that is spread across multiple tables, you will create a table relation between the two tables.

While many system tables exist, it's important to know how to create new tables and fields so you can personalize the finance and operations apps experience. Tables are added to a project through the Solution Explorer window by right-clicking the project and selecting Add > New item. You can then modify these tables through the table designer and Properties windows.

The screenshot below shows the CustTable (Customer Table).

Screenshot of the Customer Table which is called CustTable.

The Table designer window contains a top-level node with the table name, and various components beneath it, such as:

  • Fields - Make up the data in the table and can be base enumerations or extended data types.
  • Field groups - Are logical groupings of physical database fields. Groups can be used on forms and reports so that when a modification is made to a field group, related objects are automatically updated to reflect the new content of the group.
  • Indexes - Are a method for speeding up retrieval of data from a table.
  • Relations - Define how a table relates to records in other tables.
  • Delete actions - This node is used on tables that are upgraded from earlier Microsoft Dynamics AX versions. It is used to detail what should happen when data in a related table is deleted. With finance and operations apps, delete actions are specified on the properties of a table relation.
  • State machines - Enable you to perform state transitions within the workflow without writing any additional code. These are primarily used with workflows.
  • Mappings - With a map, you can associate a map field with a field in one or more tables. This enables you to use the same field name to access fields with different names in different tables.
  • Methods - Methods are pieces of code that are added to a table that can be run when certain events or changes in the data occur.
  • Events - Are also pieces of code that are raised as preceding and succeeding operations around base methods.

Fields are added to a table by using a click-and-drag motion from your project in the Solution Explorer window, or from the Application Explorer window. Fields are commonly base enumerations (base enums) or extended data types (EDTs). Because EDTs are reusable throughout the system, it is beneficial to check the Application Object Tree (AOT) to see if your desired field exists already before creating a new EDT and adding it to your project. You can also add a field to a table by right-clicking the table name in the table designer and adding a new field. You would then specify in the Properties window which element you will be referencing for that field, such as a base enum or EDT.