Create tables to store data in by using the Application Object Tree (AOT).
|Before creating new tables, review the tables that ship with Microsoft Dynamics AX to determine whether you can use existing tables. For more information, see Application Tables.|
Table fields are based on a primitive data type or an extended data type. For more information, see Primitive Data Types and How to: Create an Extended Data Type. The AutoReport and AutoLookup groups are automatically created when you create a table. For more information, see Implementing Automatic Reports for Forms and How to: Add a Control with a Lookup Form. To manage changes to AOT objects, a version control system is available. For more information, see Version Control System.
Create a Table
- In the AOT, expand the Data Dictionary node.
- Right-click the Tables node, and then select New Table.
- Right-click the table, and then click Properties.
- Rename the table by modifying the Name property.
- To specify the table as temporary, set the Temporary property to Yes. For more information, see Table Properties.
- Modify additional table properties, as needed. For more information, see Table Properties.
- To delete the table, right-click it, and then click Delete.
Add Fields to a Table
|You can delete only fields that do not contain data in any of the table records. You cannot modify the data type of an existing field.|
- Right-click the Fields node of your table.
- Click New, and then choose a primitive data type to base your field on. If you plan to base the field on a specific extended data type, you must choose a primitive data type that the extended data type is based on.
- To base the field on an extended data type, set the ExtendedDataType property.
- Modify additional field properties, as needed. For more information, see Table Field Properties.
- To delete the field, right-click it, and then click Delete.
Restart the AOS after Adding Fields to Tables
When you insert data in a table during development, the SQL statement you use to insert the data is cached in the AOS. Next you might add a new field to the table and persist the change to the database. This causes the SQL statement in the cache to become stale, because the statement is not updated to include the new field. If you reuse the stale statement, the new field is ignored, or an error might occur. To avoid this problem, restart the AOS after you persist table schema changes to the database. The cache is empty when the AOS restarts.