+ All Categories
Home > Documents > AX2009_ENUS_DEVI_02.pdf

AX2009_ENUS_DEVI_02.pdf

Date post: 21-Oct-2015
Category:
Upload: rodrigo230250
View: 19 times
Download: 3 times
Share this document with a friend
Popular Tags:
50
Chapter 2: Data Dictionary 2-1 CHAPTER 2: DATA DICTIONARY Objectives The objectives are: Understand the MorphX ® development environment and the Application Object Tree (AOT) Design tables using MorphX Create and use tables using MorphX Understand relations on Microsoft Dynamics ® AX 2009 tables Understand the different data types within Microsoft Dynamics AX 2009 Learn how to create and modify Enumerated data types Understand the use of maps in MorphX Learn how to create and modify views using MorphX Learn how to create and modify indices using MorphX Introduction This chapter introduces the tools and procedures for creating tables, data types, and relations that are required to build the foundation for a simple “Customer Birthday” module in Microsoft Dynamics AX 2009. In Microsoft Dynamics AX 2009 this is accomplished from the Application Object Tree. MorphX and the Application Object Tree The Application Object Tree (AOT) is a tree view of all application objects in Microsoft Dynamics AX 2009. Each branch node contains a different application object type. Within the AOT, a developer can create or modify Microsoft Dynamics AX 2009 application objects using drag-and-drop functionality. The system has default settings for all application object properties. This chapter focuses on those objects contained in the Data Dictionary node. It briefly discusses all the objects within the data dictionary. The rest of the application objects are discussed in later chapters. The course goes into much more detail later in the chapter with tables, maps, views, extended data types, and base enums. First, it is important to know how to use the AOT. Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
Transcript

Chapter 2: Data Dictionary

2-1

CHAPTER 2: DATA DICTIONARY Objectives

The objectives are:

• Understand the MorphX® development environment and the Application Object Tree (AOT)

• Design tables using MorphX • Create and use tables using MorphX • Understand relations on Microsoft Dynamics® AX 2009 tables • Understand the different data types within Microsoft Dynamics AX

2009 • Learn how to create and modify Enumerated data types • Understand the use of maps in MorphX • Learn how to create and modify views using MorphX • Learn how to create and modify indices using MorphX

Introduction This chapter introduces the tools and procedures for creating tables, data types, and relations that are required to build the foundation for a simple “Customer Birthday” module in Microsoft Dynamics AX 2009.

In Microsoft Dynamics AX 2009 this is accomplished from the Application Object Tree.

MorphX and the Application Object Tree The Application Object Tree (AOT) is a tree view of all application objects in Microsoft Dynamics AX 2009. Each branch node contains a different application object type. Within the AOT, a developer can create or modify Microsoft Dynamics AX 2009 application objects using drag-and-drop functionality. The system has default settings for all application object properties.

This chapter focuses on those objects contained in the Data Dictionary node. It briefly discusses all the objects within the data dictionary. The rest of the application objects are discussed in later chapters. The course goes into much more detail later in the chapter with tables, maps, views, extended data types, and base enums. First, it is important to know how to use the AOT.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-2

Procedure: Opening the AOT

Access the AOT from the Microsoft Dynamics AX 2009 application. There are three different ways to open the AOT.

• Navigate to FILE MENU > OPEN > APPLICATION OBJECT TREE.

FIGURE 2.1 OPENING THE AOT

• Click the AOT icon on the application toolbar.

FIGURE 2.2 APPLICATION OBJECT TREE ICON

• Press CTRL + D.

Features of the AOT

AOT Toolbar The toolbar located in the AOT contains five icons.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-3

The functions of these icons are as follows:

• Press CTRL + O - This opens the application object directly from the AOT.

• Press F7 to Compile the object to locate syntax errors. • Press ALT + ENTER to view the properties for the selected object. • Click CTRL + SHIFT + S to save changes. • Click the Import icon to import an .xpo file.

NOTE: Microsoft Dynamics AX 2009 objects are exported as .xpo files. These are the only types of files Microsoft Dynamics AX 2009 recognizes when trying to import into the AOT.

AOT Right-Click Menu The right-click menu in the AOT differs slightly depending on the node. This section illustrates all the functions of the right-click menu on the top level of the AOT, excluding the Data Dictionary.

This figure illustrates a right-click menu on the Tables node.

NOTE: The Open New Window command makes it possible to have more than one instance of the AOT open at a time. This makes it simpler to work with multiple objects within the MorphX environment.

Objects in the Data Dictionary

This section focuses on the application objects located in the Data Dictionary node of the AOT. The other objects in the AOT are discussed in later sections in this course. Here is a list of all the objects in the Data Dictionary:

FIGURE 2.3 AOT OBJECTS

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-4

• Tables - Tables store data in the system. They are organized in fields. These are assigned to different data types, depending on the type of data they hold. Data is entered, edited, and deleted through forms. Tables are discussed in more detail later in the section.

• Maps - Maps link one key value with another value. This can be any valid X++® data type. Maps are frequently used to link tables. By creating a map, fields can be accessed in different tables if the fields are of similar types but have different names. For example, a class that implements functionality to process data in the tables. If these tables use identical names for the columns, you can reuse data processing classes.

• Views - Views are read only data representations that combine multiple table objects. Views present a selected set of rows and columns by joining different tables through data sources and relations between them. Frequently views represent a subset of fields from a single table to simplify reporting.

• Extended Data Types - Extended data types are customized data types. They are based on the primitive MorphX data types. These include strings, integers, reals, dates, times, enums, or containers. The customizations modify system-defined behavior of primitive data types.

• Base Enums - Base enums are a list of literals. They can be used throughout the development environment in MorphX. Enums (enumerable type) are an extended data type that inherits from a base enum. The elements in an enumerable type are created by using the AOT, where the name of the type and the literals can be described in the definition.

• Security Keys, Configuration Keys, and License Codes are all part of the Microsoft Dynamics AX 2009 Security System. o Configuration Keys disable features in the application for all

users, and control user group access to specific features within the system. Each key controls access to a specific feature, and as soon as it is disabled, the feature is automatically removed from the user view.

o In most cases, configuration keys are controlled by a License Code. When a license code is purchased, the family, the parent configuration key the license code controls, cannot be disabled.

o Security Keys restrict access to features for individual user groups. Although a feature is available in the Microsoft Dynamics AX 2009 system, some users are given partial or no access to the feature. Access to a feature is controlled by selecting No Access, View, Edit, Create, or Full control.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-5

• Table Collections - Table collections do not contain any data. Virtual companies are built on table collections. They contain tables shared by more than one company. A table can be a part of more than one table collection.

• Perspectives - Perspectives organize tables, folders, fields, and roles, in subsets according to application modules in an intuitive way, matching the same concept as Microsoft SQL Server Reporting Services. Perspectives are also discussed in more detail with the use of OLAP cubes.

Tables The Microsoft Dynamics AX 2009 database created during installation contains the complete repository. Tables are at the core of the Microsoft Dynamics AX 2009 application and enable storing a company's information and transactions.

Understanding Microsoft Dynamics AX 2009 Tables

Tables storing data about company transactions, inventory, general ledger, journals and more, form the base of the Microsoft Dynamics AX 2009 application. These are referred to as base tables or application tables. Some frequently used base tables are shown as follows.

AX 2009 Table Name

Application Data Detail

CustTable The parent table for basic customer information

VendTable The parent table for basic vendor information

LedgerTable The parent table for the general ledger that contains the chart of accounts information

InventTable The parent table for the general inventory catalog

PurchTable The parent table for purchase order creation information

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-6

FIGURE 2.4 BASE TABLES

Other tables in Microsoft Dynamics AX 2009 contain metadata. These tables contain descriptions of data. This is not data found in a business transaction or business entity such as the ledger table. Metadata is housed in system tables. System tables are differentiated from application tables by the Sys prefix that starts the name of the table. Examples of system and application tables are shown in the following figure.

FIGURE 2.5 SYSTEM TABLES

Microsoft Dynamics AX 2009 Table Structure and Components

Tables in Microsoft Dynamics AX 2009 contain multiple elements that define the table. There are six categories that define tables:

• Fields • Field Groups

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-7

• Indexes • Relations • Delete Actions • Methods

This figure illustrates these elements:

FIGURE 2.6 TABLE CATEGORIES

Fields

Access the Fields node using MorphX to create or modify the physical columns in the database table. The fields that are defined within the Fields node are the columns belonging to the physical table named CustTable.

CAUTION: Any fields created, deleted, or modified using MorphX in the Table node are reflected in the database. This can potentially damage the Microsoft Dynamics AX 2009 application if not used correctly.

Display all the fields for the CustTable by opening the Fields node. The figure below illustrates how MorphX allows for direct viewing of all the columns within a Microsoft Dynamics AX 2009 table.

FIGURE 2.7 FIELDS IN THE CUST TABLE

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-8

Field Groups

Field groups in Microsoft Dynamics AX 2009 are logical groupings of physical database fields. Microsoft Dynamics AX 2009 uses Field Groups to cluster fields into logical groups so that these groups can be used with other Microsoft Dynamics AX 2009 objects, such as forms and reports. An example of such a group is the group Address located within the Address field group of the CustTable.

NOTE: If a modification is made to a field group, related objects are automatically updated to reflect the new content of the group. Remember that IntelliMorph adjusts the layout of forms and reports which use the modified field group. Adding new fields to a field group can be a powerful technique for updating forms that use field groups with a new field.

The CustTable has seventeen Field Groups. Two of the groups are used for automatic tasking such as Auto Reporting and Auto Lookup.

FIGURE 2.8 FIELD GROUPS IN THE CUSTTABLE

It is a best practice to use standardized names when field groups are created. These names include the following:

• Identification • Administration • Address • <module name> (for example “Ledger”) • Setup • Dimension • Misc

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-9

The Field groups can be viewed in the preceding figure.

By expanding the Address field group as shown in the following figure, notice the fields that are grouped together. The six fields circled form the address group. Grouping them together as a single object helps in development efforts.

FIGURE 2.9 FIELD GROUPS IN THE CUSTTABLE

BEST PRACTICES: Define a group when several fields logically belong together and are shown together on forms and reports. Any field that appears in the user interface should belong to a group. The field group named Misc can be used for this purpose. This means that field groups can always be used to design forms.

Indexes

The indexes in the Microsoft Dynamics AX 2009 table definition are the physical indexes that exist on the tables in the database. Indexes speed searching capability and are discussed in more detail later in this chapter.

There are two types of indexes:

• Unique • Non-Unique

If a unique index is created based on a column (or a set of columns), Microsoft Dynamics AX 2009 makes sure that no duplicate keys occur in that column (or set of columns).

Non-unique, or cluster indexes, are created for performance reasons. They provide a quick way of retrieving data, instead of performing a full-table search of all the records in the table.

BEST PRACTICE: Use the suffix ‘Idx’ when naming indexes.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-10

Relations

Microsoft Dynamics AX 2009 can create relationships between tables using MorphX.

• These relations are defined within the Microsoft Dynamics AX 2009 application and not at the physical database level.

• Relations govern the relationships between data in different tables and extended data types, such as foreign key relationships.

• Foreign key relationships between tables are always formed from the parent table.

• Form the relationship starting with the subordinate table; it is not necessary to go back to the parent table.

FIGURE 2.10 FOREIGN KEY RELATION

Under the relations node you can create different types of relationships between the parent table and other tables in Microsoft Dynamics AX 2009.

The following figure shows the different types of relationships that exist for CustTable. There are nodes for a variety of different Relations such as BankAccounts and State.

Delete Actions

Microsoft Dynamics AX 2009 uses a category of methods called Delete Actions to govern how data is handled when a deletion event occurs in a parent table. There are four types of delete actions:

• None - The row in this table is deleted but nothing occurs to the tables that relate to this table.

• Cascade - The row in this table is deleted and all data in relating tables is also deleted.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-11

• Restricted - The row in this table is only deleted if there is nothing that relates to it.

• Cascade + Restricted - Cascade delete even though records exist on related tables. A warning appears; if clicking No nothing occurs; if clicking Yes the cascade deletion runs.

NOTE: Exercise caution when setting up delete actions, as misuse may cause orphaned records.

Methods

Microsoft Dynamics AX 2009 uses methods within the table node to perform a variety of functions such as contact person and currency name lookup. In addition, Microsoft Dynamics AX 2009 uses methods to find open orders and other tasks. Methods are coded using X++.

The methods may be modified using MorphX to provide custom functionality.

Creating Tables Existing tables in Microsoft Dynamics AX 2009 can be modified or new tables may be created using the MorphX tools in the AOT.

Procedure: Creating a Table in Microsoft Dynamics AX 2009

There is a specific sequence for the successful creation of a new table. The steps are as follows:

1. Create a table. 2. Create extended data types. 3. Add fields to the table.

a. Drag relevant extended data types to the Fields node of the relevant table.

4. Create relations on extended data types. 5. Create indexes.

Each of these steps contains sub steps that are demonstrated in the following sections.

NOTE: Microsoft Dynamics AX 2009 has a Version Control System; if this is enabled, the procedure differs from what is described here.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-12

Demonstration: Creating a Table

The structure of this table includes the birthdays of customers, their account numbers, and any gift ideas that might be suited for them.

• Right-click the Tables node in the Data Dictionary in the AOT and select New Table.

FIGURE 2.11 SELECTING NEW TABLE

2. Rename the table by right-clicking on the table and selecting

Rename from the right-click menu. 3. Name the table CustBirthday.Expand the node of the CustBirthday

table and view all the categories discussed previously.

FIGURE 2.12 CUSTBIRTHDAY CATEGORIES

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-13

4. Add the appropriate fields to this table. 5. To add new fields, right-click the Fields node and select New from

the right-click menu; then select from one of the primitive data types for creating the new field. a. In this case, use the data type of Date for the ‘birthday’ field.

FIGURE 2.13 SELECTING DATE FOR A FIELD

b. Rename this field by right-clicking and selecting Rename from

the right-click menu and typing ‘birthday’.

6. Repeat this process to create two more fields: Enum field: GiftIdeas String field: AccountNumber

7. Figure below illustrates the completed table:

FIGURE 2.14 THE COMPLETED TABLE

a. Save the table.

NOTE: Microsoft Dynamics AX 2009 synchronizes the table when Saving. Synchronizing a table automatically creates or updates it into the underlying database.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-14

Another way to synchronize is by selecting the Synchronize entry from the right-click menu on the table.

FIGURE 2.15 SELECTING SYNCHRONIZE

Table Tools – The Add-Ins Submenu

Microsoft Dynamics AX 2009 offers many types of support when working with the MorphX environment. One kind of support can be found by right-clicking the object and selecting Add-ins. Some of these commands are also available on the Tools menu's Development submenu. The difference between using commands from the Development menu and using commands from the Add-ins menu is that the commands in the shortcut menu take the current node as the object to apply the actions taken.

Here are some of the available options in the Add-ins Submenu:

• Cross reference - Contains facts about the object, where it is used, and relations to other objects.

• Application objects - Displays general, date, and version information about the current application object.

• Developer Documentation - Contains documentation for the developer.

• Table definitions - Generates a report presenting an overview of the current table fields, types, labels, configuration keys, and help texts.

• Table Browser - Displays the contents of a table. From the Table Browser, write SQL scripts and insert data directly into a table. This is explained in the next section.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-15

Auto Report - Creates a report that uses information in the AutoReport field group on the current table object.

Code Explorer - Views code in a Help window and eases navigation within application object components, code view can display either X++ source code, or the contents of a property sheet and a list of child nodes.

The Application Hierarchy Tree - Displays the current object's inheritance hierarchy.

Compare - Compares the current object with another object, or another version of the same object.

Code upgrade - Used when upgrading Microsoft Dynamics AX 2009, the code upgrade window displays methods in bold that conflict between versions.

Find and replace - Used to find/replace text in the X++ code on the current object, including its children.

Syntactic renaming - Makes a qualified find and replace in the X++ source code.

Check Best Practices - Checks if the X++ code complies with Microsoft Dynamics AX 2009 standards.

Viewing and Searching Data in Microsoft Dynamics AX 2009 Tables

MorphX lets the user view data in Microsoft Dynamics AX 2009 tables using the Table Browser tool. The Table Browser operates from the Add-ins menu of MorphX and returns a record set to the user.

NOTE: This option is only available with the purchase of the X++ source code module.

Because this tool returns an updatable record set, the data within the table may be edited within the utility. This can be a very dangerous tool because data edited here alters the database. The Table browser also allows for sorting and searching of specific data.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-16

CAUTION: Improper use of the Table Browser tool may result in corrupted records that may render the company unusable.

1. Open the customer table CustTable and select Table Browser from the Add-Ins menu as shown in the following figure.

After selecting the Table Browser, a form opens that contains data from the customer table. Notice that the SQL statement used to obtain the data appears in the lower part of the window as shown in the following figure.

2. Alter the SQL statement manually and re-query the data to change the display results.

Also use the standard search options explained in an earlier course, if desired.

To sort the data into an ordered manner, access the MorphX menu and select Sort Ascending or Sort Descending.

The customer Name data is sorted in an ascending order for viewing purposes.

To remove a filter or sort order, use Remove Filter/Sort from the MorphX menu or the toolbar.

To view the customer form associated with the customer table, move the pointer into the first column of the table browser window and open the MorphX menu. Select Go to the Main Table Form.

The customer form connected to the customer table appears as shown in the following figure.

Now, the data within the customer table is successfully browsed and a search performed without leaving the MorphX environment.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-17

Lab 2.1 - Table Creation Create a Table that will store data for a list of Company Holidays

Challenge Yourself!

1. Create a New Table in Microsoft Dynamics AX 2009 named CompanyHolidays.

2. This table should contain three fields that have appropriate data types and labels: o Field 1: Name of holiday o Field 2: Date of holiday o Field 3: Day of week the holiday falls on

NOTE: For this exercise, try to use pre-existing labels if it is possible using the ‘Find Label’ dialog box.

3. Assign the following Extended Data Types to the appropriate fields:

o DateDayName o DatePhysical

4. Name

Step by Step

Solution

Table Creation

1. To create the basic table named Company Holidays right-click the Table node in the AOT and select New Table.

2. After the Table is created, a new Table named Table1 displays. 3. Open the Fields branch and create the fields in the Table. Set up a

correspondence for field name, field label, and description:

Field Name Field Description Field Label HolidayName Name of the Holiday Holiday

HolidayDate Date of Holiday Date of event

DayName Name of the Day the Holiday is on

Days

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-18

1. The correct primitive types to assign are as follows: a. HolidayName as → String b. HolidayDate as → Date c. DayName as → String

2. To create the fields for the new Table use the MorphX menu field

creation method. 3. Open the properties menu for the new field and set its Name and

Label properties according to the instructions in the exercise. Remember to use the Find Label method with the keyword Holiday. If there are no appropriate labels then create a new one

4. Create the rest of the fields in the same manner. 5. Open the properties sheet for the new field and set its Name and

Label properties. Locate the label using the Find Label method with the keyword Date of event.

6. Create the last field for the name of the day on which the holiday falls.

7. Set the Name and Label properties for the DayName field. 8. Set the Name and Label properties of the table to CompanyHolidays

and Holidays respectively. 9. Synchronize and save the work.

Extended Data Types

The appropriate Extended Data Type assignments are as follows:

• DateDayName assigned to → DayName field. • DatePhysical assigned to → HolidayDate field. • Name assigned to → HolidayName field.

1. To find the appropriate Extended Data Types listed above use the

MorphX drop-down menu on the Extended Data Properties. 2. Repeat the process for all the fields.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-19

Relations Relations are a method that helps secure business rules to enforce existing properties between field values existing in different tables. This is known as referential integrity. There are many different kinds of referential integrity.

A relation may be created on an Extended Data Type in the same manner it is created for a field existing in a table.

Relations not only serve to enforce business rules in Microsoft Dynamics AX 2009, they are also used for other important tasks, such as:

• Creating auto joins in forms. • Looking up values in other tables (using lookup list/selection list

boxes and the Go to Main Table command). • Validating data by providing constraints. • Automatically propagate changes from one table to another by

defining cascading relations. • Generating ToolTips. • Auto defining relations in queries.

The customer birthday is an example in which to enforce that only customer account numbers exist in the table, and that vendor numbers are not accidentally input into the customer birthday table.

To prevent this, build a relationship between the CustBirthday table and the Microsoft Dynamics AX 2009 customer table named CustTable. This relationship enforces future input to the table and insures that only customers receive gifts.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-20

Demonstration: Creating a Relation on the CustBirthday Table

This demonstration shows the steps to follow when creating relations.

1. Expand the CustBirthday table node by right-clicking the Relations node and selecting New Relation.

FIGURE 2.16 EXPANDING A TABLE NODE

o A framework for the new relation is created.

2. Open the properties sheet for the relation. 3. The Properties sheet shows three properties: Name, Table, and

Validate.

FIGURE 2.17 RELATION PROPERTIES SHEET

4. Name the relation CustomerGifts. Verify that the Validate property

is set to Yes. o The Validate property ensures that data in the parent table is

checked according to the Relation being constructed.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-21

5. The table to designate as the parent table for the Relation is the Microsoft Dynamics AX 2009 customer table named CustTable. Select the name of the table from the drop-down menu of the Table property.

FIGURE 2.18 SELECT CUSTTABLE

6. Close the Properties sheet, and then highlight the Relation, and

right-click to access the right-click menu.

FIGURE 2.19 SELECTING A FIELD RELATIONSHIP

There are three types of field relationships that can be assigned.

• Normal relationships enforce referential integrity such as foreign keys.

• Field fixed works as a trigger to verify that a relation is active. If an enum field in the table has a specific value, then the relation is active.

• Related field fixed works as a filter on the related table. It only shows records that match a specified value for an enum field on the related table.

7. Create a normal relationship for CustomerGifts.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-22

8. This enforces the referential integrity constraint that the customer account number within the customer birthday table must exist in the customer table. The skeleton of the relation is created as shown in the figure below:

FIGURE 2.20 RELATION SKELETON

g. Open the Properties sheet of the relationship and define the field relations between the fields of the CustBirthday table and the table CustTable.

The Field property refers to the assigning table (CustBirthday). The RelatedField property refers to the relating table (CustTable).

The following figure shows the completed relationship between fields after closing the properties sheet.

FIGURE 2.21 COMPLETED RELATIONSHIPS

Data Types – Primitive and Extended Microsoft Dynamics AX 2009 has built in primitive and extended data types associated with the information in the database.

Primitive Data Types

The basic set of primitive data types in Microsoft Dynamics AX 2009 map to underlying data types that exist in the physical database. These primitive data types can be expanded to create Extended Data Types, which are reusable data types having a specific definition.

The primitive data types enabled within Microsoft Dynamics AX 2009 are:

• String • Integer

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-23

• Real • Date • Time • UTCDateTime • Enum • Container • GUID • Int64 • Boolean

Field Name Field Description String A number of characters.

Integer A number without a decimal point. 32 bits wide.

Real A number with a decimal point.

Date Contains day, month and year.

Time Contains hours, minutes and seconds.

UTCDateTime A combination of Data and time types into one data type that also holds timezone information.

Enum A set of literals that may be represented internally as Integers

Container A composite data type that is a dynamic list of items containing primative data types and/or some composite data types.

GUID Globally Unique Identifier. A 16-byte number generated that uniquely identifies a network or interface.

Int64 A number without a decimal point. 64 bits wide.

Boolean Only contains the values false and true.

Extended Data Types

Extended Data types can inherit either from primitive data types or other Extended Data Types, which enables properties to be inherited.

The benefit of creating Extended Data Types is the reuse of its properties. For example, if a table field is created based on an Extended Data Type (EDT), the new field's element properties are automatically inherited from the EDT.

Another benefit is more efficient maintenance. The properties of many fields can change at one time by changing the properties on the EDT.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-24

Some important facts about Extended Data Types are in the following list:

• Extended Data Types can be based on primitive MorphX data types or on another EDT.

• If it is possible, custom tables have fields based on Extended Data Types.

• A relation can be assigned to an Extended Data Type and it can be made a Related Field Fixed relation. Most fields in Microsoft Dynamics AX 2009 tables are based on Extended Data Types. After it is created it can be reused as many times as it is needed in the application.

The creation of the Extended Data Type shown in the preceding figure is based on a String primitive Data Type. This Extended Data Type can be used anywhere within Microsoft Dynamics AX 2009 where a field requires the same properties.

Demonstration: Data Types

The following demonstration examines the properties of the AccountNumber field created in the CustBirthday table. Start by using the right-click menu to open the Properties page for the AccountNumber field. The Properties sheet is displayed after the method is selected.

From the Properties sheet, the primitive data type assigned is a String and has a size of 10 by default. The ExtendedDataType property is not yet set.

To view how these properties translate into a physical database data type, the following figure illustrates the design of the field from the database.

This is the mapping given by Microsoft Dynamics AX 2009 for the AccountNumber field originally defined as a String. The field birthday with a primitive data type of type Date is translated as Date. However, the GiftIdeas field of type Enum has a non-intuitive translation.

When primitive data types are incompatible with those supported by the database, Microsoft Dynamics AX 2009 extends its data type into an existing one. That is why the primitive data type Enum of the GiftIdeas field is mapped to an integer in the database. The Microsoft Dynamics AX 2009 Application Object Server (AOS) can use stored metadata to translate the Enum data type into a list of values presented to the user. After defining the customer gift ideas, they are stored in the database as integer values but appear on a form as a list of gift ideas.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-25

Demonstration: Creating an Extended Data Type

This demonstration examines a similar extended data type. First, explore the properties of the BirthDate extended data type by viewing the properties of this object.

FIGURE 2.22 EXTENDED DATATYPE BIRTHDATE PROPERTIES SHEET

It is clear from viewing the Properties sheet that Microsoft Dynamics AX 2009 developers have thought of an Extended Data Type for an employee's birthday; but an Extended Data Type for a customer's birthday does not exist.

The Extended Data Type BirthDate is an example of basing an extended type on another extended type, because it is based on the Extended Data Type called TransDate. TransDate is also an Extended Data Type based on the primitive type of Date.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-26

The following procedure creates an extended data type for a customer's birthday.

1. Right-click the Extended Data Types node and select New. Assign the primitive data type of Date to this new Extended Data Type.

FIGURE 2.23 ASSIGNING A DATA TYPE TO THE NEW EXTENDED DATATYPE

2. Rename the new extended data type to Birthday. 3. Open the Properties sheet and find the property called Extends. For

the new data type to inherit the behavior from the existing Extended Data Type BirthDate, select BirthDate from the drop-down menu.

FIGURE 2.24 SELECT THE EXTENDED DATA TYPE

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-27

4. Set the label property for the new Extended Data Type to Birthday.

FIGURE 2.25 SET THE LABEL

o Now, a new Extended Data Type named Birthday is created that

is based on the already existing Extended Data Type BirthDate.

5. Save the new Extended Data Type. o Assign this new Extended Data Type to the Birthday field on

the CustBirthday table.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-28

6. Open the Properties sheet of the Birthday field on the CustBirthday table and set the Extended Data Type to Birthday as shown in the following figure.

FIGURE 2.26 SET THE DATA TYPE

NOTE: Assigning an Extended Data Type to a field on a table causes that field to inherit all the properties of the extended data type. Therefore, this Birthday field has the label “Birthday.” It is not necessary to assign a label to the field property.

7. Close the Extended Data Type branch, open the Tables branch, and

synchronize the database by right-clicking on the Table and selecting Synchronize.

Understanding Extended Data Types

To understand the concept of an Extended Data Type, assign an Extended Data Type to the AccountNumber field created in the previous customer birthday table example.

The AccountNumber field in the CustBirthday table can inherit the Account Number properties in the customer table. To create appropriate assignments, explore what data type the customer table uses for its account number field. Because the account number in the birthday table is the same field, assign the same Extended Data Type that exists for account numbers in the customer table to customers in our birthday table.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-29

Demonstration: Assigning an Existing Extended Data Type to a Field

This demonstration assigns an extended data type to a field.

1. Within the AOT, locate the customer table named CustTable. 2. Assign the properties of the account number found in the CustTable

to the account number in the CustBirthday table. o The Extended Data Type of a field is a property on the field. To

examine the properties of the AccountNum field, highlight the field and then click the Properties menu item to expose the Properties sheet.

FIGURE 2.27 PROPERTIES SHEET OF ACCOUNTNUM FIELD IN THE CUSTTABLE TABLE

o The account number in the customer table has an Extended Data

Type value named CustAccount. This is the same inheritance that needs to be passed along to the account number in the table that is created.

3. Expand the Fields node within the CustBirthday table. 4. View the properties sheet for the AccountNumber field. 5. Select CustAccount as the value for the Extended Data Type

property from the drop-down list. 6. Save the modifications. The AccountNumber field in the customer

birthday table is now assigned the CustAccount Extended Data Type.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-30

Base Enumerations (Base Enums) Base enumerations are used as data lists for fields of the Enum type. Base enumerations, also named Base Enums, are used for assignment to Enum primitive data type fields that require a set of predefined values. The elements of a base enumeration are defined as string values and assigned an integer identifying value. As soon as constructed, the base enumeration may be assigned to any field that is defined as type Enum.

Base Enums

The base enumeration that describes the status of a customer and or vendor payment is shown in the following figure.

The base enumeration defines the status of a customer or vendor payment and the values that can be selected. The status code of Received is shown with its identifying integer value of 5. The identifying integer value is never used for display purposes but serves as the unique Index for the string value of the element.

Base enumerations or Base Enums are data types that enable list objects to be created within Microsoft Dynamics AX 2009. The list object is an indexed drop-down menu whose values are specified at design time. These lists can be used as cells within grid objects or as objects resigning independently on a form.

Base Enums provide a choice of items from a defined list that may be assigned or modified. For example, a field designating the month that belongs to a transaction should contain twelve months and possibly a null designator. Microsoft Dynamics AX 2009 contains a Base Enum for this purpose.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-31

Expanding the Base Enums node opens the Base Enums in the Microsoft Dynamics AX 2009 application. The following figure illustrates an example of a Base Enum for the months of the Year, which is named MonthsOfYear.

FIGURE 2.28 BASE ENUM FOR MONTHSOFYEAR

Demonstration: Creating Base Enums

The following demonstration shows how to create a Base Enum for the field named GiftIdeas in the CustBirthday table. The rows of the CustBirthday table represent a customer's account number, birthday and an Enum data type field intended to house different gift ideas.

1. Right-click the Base Enums node in the AOT and select New Base Enum. o Literal values of a base enum in the AOT are called Elements.

Add three elements to this Base Enum.

2. Rename the new Base Enum to GiftIdeas and give it a label of GiftIdeas.

FIGURE 2.29 GIFTIDEAS ENUM

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-32

3. To add elements to a Base Enum, right-click the created base enum and select New Element.

FIGURE 2.30 SELECT NEW ELEMENT

4. View the properties sheet for this element. 5. Set the Name of the element to Idea1 and the Label of the element to

Ties. The Name represents a name given to the element on the AOT and its label value is the value presented in the user interface.

FIGURE 2.31 SET THE LABEL PROPERTY

6. Create two other elements: one named Idea2 with a label of Watches

and the other named Idea3 with a label of Theater Tickets. o Notice how the value of the EnumValue property starts with the

value of zero (0) and automatically increments itself by one (1) for every idea added. These EnumValues are how Microsoft Dynamics AX 2009 tracks in the database the enumerated properties being defined.Demonstration: Creating an Extended Data Type That Uses a BaseEnum

Now that a base enumeration is created for different gift ideas, assign it an Extended Data Type.

1. Create a new Extended Data Type. 2. Open the Properties sheet for the new object created and give it a

name of Gifts and a label Gifts.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-33

3. Assign the EnumType property to the GiftIdeas Extended Data Type created earlier. o There is now an Extended Data Type based on the GiftIdeas

Base Enum.

FIGURE 2.32 EXTENDED DATATYPE USING A BASEENUM

4. Save the work created and synchronize the object to the database. 5. Now assign the Gifts Extended Data Type to the GiftIdeas field in

the customer birthday table. Open the Properties sheet for the GiftIdeas field and assign the ExtendedDataType property the value Gifts.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-34

6. After assigning the Extended Data Type the Enum Type property automatically fills in by clicking the Enum Type property value.

FIGURE 2.33 EXTENDED DATATYPE ASSIGNED TO THE FIELD GIFTIDEAS

7. Now, a new base enumeration is created and an Extended Data Type

based on it. This new Extended Data Type is also assigned to a field in the customer birthday.

Maps Maps define X++ elements that wrap table objects at run time. With a map, a map field is associated with a field in one or more tables. This enables to use the same field name to access fields with different names in different tables. Map methods enable to create or modify methods that act on the map fields.

A table can be accessed through more than one map. Typically, if more than one map accesses the same table, each map accesses different subsets of fields in the table. Maps do not define database objects and so they are not synchronized with the database.

Maps

An example of a Map is the CustVendTable Map. This map has fields created from existing Extended Data Types. The fields are then mapped to physical data values that exist in Microsoft Dynamics AX 2009 tables through the Mappings node of the Maps branch.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-35

This following figure shows some of the fields that are defined in the CustVendTable map.

FIGURE 2.34 CUSTVENDTABLE MAP

The mapping of these fields is performed in the Mapping node of the Map. The table nodes for the mapping are shown in the following figure.

Explore some of the actual mappings that exist for the Map fields under the CustTable node.

Open the Properties sheet of the AccountNum mapping to reveal its properties.

The mapping creates a lookup between the Extended Data Type AccountNum in the CustTable and the AccountNum field that exists in the map.

Creating the supporting logic and methods for a map is a subject addressed in a later course.

Views A Microsoft Dynamics AX 2009 view is a virtual table that provides the data records and fields that are specified by a query. The following sections describe views and how they retrieve data.

Like a table, a view uses fields and rows to represent data records. However, the data in a view is not stored as a database object but is dynamically created when the view is accessed. A view uses a query to retrieve data fields from one or more database tables.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-36

In Microsoft Dynamics AX 2009, use views where tables are used. For example, use a view in a form, a report, and in X++ code. The following table shows the benefits of using a view instead of a table.

Benefit Description Focused Data A view is used to retrieve and return only the data that

is relevant for a particular user or scenario.

Customized Data A view enables the use of a complex query to create a highly-customized set of data. For example, a view often represents data as a single table that is retrieved from multiple joined tables and used many conditions.

Performance A view can improve performance by returning only relevant fields to the user. In addition, a view definition is compiled which may provide better performance than calling an equivalently complex query.

When a view is created, the view definition is generated and stored in the database. When that view is accessed, the view dynamically retrieves the data that satisfies the view definition.

NOTE: Views are read-only. The data fields and tables that a view uses cannot be updated from that view.

Views are synchronized like tables. When a view is synchronized, the view definition is saved to the database. Synchronization of an existing view causes the definition of that view to be dropped and re-created in the database.

Demonstration: Creating Views

This demonstration shows how to create a view.

1. Right-click the Views node and select New View. Name this view CustBirthdayView.

2. Expand the node for the new view to reveal the object categories associated with it.

FIGURE 2.35 EXPAND THE VIEW

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-37

o The Metadata branch contains the tables, relations, and constraints of the underlying SQL query that is used to form the View. The SQL query itself is formed from data sources.

o The Fields branch tells what fields are included in the View. Fields in a View inherit the data type from the fields in the Data Sources.

o The fields in a View are displayed as if they belonged to a Microsoft Dynamics AX 2009 table. There is an exception however that enables the data in a field to be displayed as an aggregated value. This depends on the data type of the field in the View.

o To perform aggregation on a field within a View the field must be a numeric field, because aggregation functions are not valid for a String, Date, or Enum data type.

3. To create a data source that can be used to construct a View, drag-and-drop a data source from the tables’ node in the AOT. a. Right-click the Tables node in the AOT and select Open New

Window. This opens a subset of the AOT that contains only Tables.

b. Drag the CustBirthday table from the Tables node in the AOT to the ‘Data Sources’ node within the Metadata of a View.

FIGURE 2.36 DRAG THE TABLE

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-38

4. Add a data source to the new data source CustBirthday. This new data source is the CustTable. Using the same technique, drag the CustTable onto the Data Source node of the CustBirthday data source.

FIGURE 2.37 DRAG THE CUSTTABLE

5. Create a relation between the data sources so that the data within

each Data Source can be joined together. Right-click the relations node of the CustTable Data Source and select New Relation.

FIGURE 2.38 RELATIONS NODE

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-39

6. If a relation exists between the two data sources this relation is inherited automatically. Change this relation if it is required. Do this similar to creating relations in a table or extended data type. Add fields to the view by dragging fields from the Fields node of the Data Sources to the Fields node of the View.

FIGURE 2.39 ADD FIELDS

7. Add fields to the view by dragging fields from the ‘Fields’ node of

the Data Sources to the ‘Fields’ node of the View. o CustBirthday fields: AccountNumber, birthday, Giftideas o CustTable fields: Name, Address, City, State, and ZipCode

8. Perform the same set of actions until all fields are added.

o A row of data has been created in the CustBirthday table. This is sufficient for testing of the new View. After closing the Table Browser, save the table so that the data synchronizes to the database.To test the CustBirthdayView, open the View in the Table Browser as we did with the CustBirthday table.Lab - Views

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-40

9. Close the properties sheet and save the new View. o To test the new view, enter data into the CustBirthday table. To

add data to the CustBirthday table, use the Table browser. Right-click the CustBirthday table in the AOT and select ADD-INS→TABLE BROWSER.

o A form displaying the rows and fields within the table appears.To enter data to the table, press CTRL + N and populate the row of the table that is made available. For the demonstration, select an AccountNumber of 4001, a birthday of March 11, 1967 and set Theater Tickets as the gift idea.

o A row of data has been created in the CustBirthday table. This is sufficient for testing of the new View. After closing the Table Browser, save the table so that the data synchronizes to the database.To test the CustBirthdayView, open the View in the Table Browser as we did with the CustBirthday table.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-41

Lab 2.2 - Views Create a View that will join your new CompanyHoliday table to the Microsoft Dynamics AX 2009 WorkCalendarDate table

Challenge Yourself!

Create a View that will join your new CompanyHoliday table to the Microsoft Dynamics AX 2009 WorkCalendarDate table.

• From the CompanyHoliday table o HolidayName o HolidayDate o HolidayDayofWeek

• From the WorkCalendarDate table

o WorkTimeControl o TransDate

Need a Little Help?

1. Create a new view. 2. Add the appropriate data sources and create a relation between them. 3. Include the following fields in the View:

o From the CompanyHoliday table o HolidayName o HolidayDate o HolidayDayofWeek o From the WorkCalendarDate table o WorkTimeControl o TransDate

4. Enter the following information into your CompanyHoliday table.

o Holiday Name: Christmas o Holiday Date: 12/25/2006 o Name of the Holiday Day: Saturday

5. Test the view by opening it in a Table Browser.

o This should return a table that contains five columns, one for each field in the view, and the WorkTimeControl field should display Closed.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-42

Step by Step

Solution

1. Constructing the CompanyHoliday View is accomplished by creating a new View.

2. Create two Data Sources for the new View. 3. Open the Properties sheet of the first Data Source created and set its

Table Properties. 4. When opening the Properties sheet change the Table Properties only.

The Name property is automatically set from the Table name. 5. Create the other Data Source for the view by opening the branches of

the first Data Source. The empty Data Source node is below the first created Data Source.

6. Open the Properties sheet for the second Data Source and set its Table property to WorkCalendarDate table.

7. Set up a Relation between the Transaction Date field (named TransDate) in the WorkCalendarDate table and the HolidayDate field in the CompanyHolidays table. Create the new Relation using the Relations node found in the very last Data Source.

8. Open the Properties sheet of the newly created Relation. 9. Set the Field property and Related Field property, where TransDate

field is equal to the HolidayDate field. 10. Drag all the relevant fields from the first Data Source into the Fields

branch of the View. 11. Use the same procedure for the WorkCalendarDate Data Source that

was the second Data Source created. 12. Set the Name property of the View to CompanyHoliday. 13. Save your work using the MorphX menu. 14. Test the new View by opening it with the Table browser. 15. If the View is correctly constructed it should show:

a. TransDate b. WorkTimeControl c. HolidayName d. DayName e. HolidayDate

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-43

Indices Indices in databases have the same purpose as in a printed book although they are made in another way. An index for a book is a guide to the pages in the book, whereas an index for a table in a database provides a reference to a record or a set of records.

There are two types of Indices: unique and non-unique. If a unique index is created based on a certain column, Microsoft Dynamics AX 2009 makes sure that no duplicate key values occur in that column. In the same manner, updates on a column that contain a unique index, which violates the uniqueness of the column, cause an error.

Non-unique Indices are created for performance reasons. They provide a quick way of retrieving data, instead of performing a full-table search of all the records in a table. Do not create an indefinite number of Indices because they use system space and must be updated every time system data is created, edited, or deleted. This can slow down the updating process. When an Index is created, it is recommended to give the Index a name reflecting the names of the related fields, followed by the suffix IDX.

Creating Indices

Creating an Index in Microsoft Dynamics AX 2009 always relates to the table where it is created. The Index can only be created on fields that exist in the table. These Indices may be unique or non-unique, and are based on either a single column or multiple columns that exist within the table.

NOTE: A field of data type memo or container cannot be used in an index.

NOTE: Microsoft Dynamics AX 2009 requires a unique index on each table so if there are no indexes on a table or all the indexes are disabled, a system index is automatically created. The system index is created on the RecId and DataAreaId fields if the DataAreaId field exists. Otherwise the system index is created on the RecId field. System indexes can be seen in the database but they are not visible in the AOT.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-44

Demonstration: Creating an Index

Create an Index on the CustBirthday table. If information is known about whether the company acquired theater tickets in a promotion, then it is possible to do a quick search on those customers who have theater tickets listed as their gift idea, and to reserve those tickets for them.

1. Expand the Tables branch of the AOT, locate the CustBirthday table and reveal the Indexes branch. Right-click the Indexes node and select New Index. Rename this to birthdayidx.

2. Set the AllowDuplicates property to Yes and the Enabled property to Yes.

FIGURE 2.40 ALLOWDUPLICATES PROPERTY

3. Add the GiftIdeas to the index, using the drag-and-drop. Expand the

Fields node and drag the GiftIdeas field to the birthdayidx index. o The Index for the CustBirthday based on the field GiftIdeas is

now complete and appears on the following AOT.

FIGURE 2.41 GIFTIDEAS INDEX

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-45

Primary Index

A primary key is one or more columns that uniquely identifies one record in a table from all the other records.

A Primary Index is a unique index for a table that defines the primary key for that table. To set an index as a unique index, set the index property Allow Duplicates to No.

A typical example of the primary key is the CustTable where the customer's AccountNum is used as a primary key. This primary key is used as the Primary Index for the CustTable table.

FIGURE 2.42 ACCOUNTIDX AS THE PRIMARY INDEX FOR CUSTTABLE

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-46

Lab 2.3 - Indices Create an Index that is a unique index of the new CompanyHoliday table on the field HolidayDate. Set the new unique index as the Primary Index on the CompanyHoliday table.

Challenge Yourself!

Create an Index called HolidayDateIdx that will be a Primary Index for the CompanyHoliday table on the field HolidayDate.

Set the Primary Index property on the CompanyHoliday table to be the new index HolidayDateIdx.

Step by Step

1. With the CompanyHoliday table open in the AOT, reveal the Indexes branch. Right-click the Indexes node and then select New Index. Rename this to HolidayDateIdx.

2. Set the AllowDuplicates property to No and the Enabled property to Yes.

3. Add the HolidayDate to the index, using the drag-and-drop. Expand the Fields node and drag the HolidayDate field to the HolidayDateIdx index. a. The Index for the CompanyHoliday based on the field

HolidayDate is now complete.

4. Select the CompanyHoliday table, right click and select synchronize from the menu.

5. Open the properties for the CompanyHoliday table, and set the property Primary Index to HolidayDateIdx. a. The Primary Index for CompanyHoliday is now complete.

Summary This chapter discussed the Microsoft Dynamics AX 2009 Data Dictionary and the related objects in the AOT.

This chapter also introduced the tools and procedures for creating tables, data types, and relations that are required to build the foundation of any table in Microsoft Dynamics AX 2009.

The next chapter examines the User Interfaces in Microsoft Dynamics AX 2009 such as Forms, Menus, and other non-graphical objects.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-47

Test Your Knowledge Test your knowledge with the following questions.

1. Task: Put the following steps in order to create a new Primary Index in a table.

Step _____ : Add the primary key field(s) to the index

Step _____ : Set the Allow Duplicates property on the index to No

Step _____ : Set the Primary Index on the Table to the Unique Index

Step _____ : Create a new index

Step _____ : Set the name for the new index

Step _____ : Synchronize the AOT

2. Allowable data types for an index may include:

( ) String, Integer, Real, and Container ( ) String, Enumerated, Real, and Memo ( ) String, Integer, Real, and Enumerated ( ) Memo, Container, Map, and integer

3. Nodes required to define a table include: (Mark all that apply.) (Select all that apply.)

( ) Fields ( ) Field Groups ( ) Maps ( ) Enumerated data types

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-48

Quick Interaction: Lessons Learned Take a moment and write down three key points you have learned from this chapter:

1.

2.

3.

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Chapter 2: Data Dictionary

2-49

Solutions Test Your Knowledge

1. Task: Put the following steps in order to create a new Primary Index in a table.

Step 4 : Add the primary key field(s) to the index

Step 3 : Set the Allow Duplicates property on the index to No

Step 6 : Set the Primary Index on the Table to the Unique Index

Step 1 : Create a new index

Step 2 : Set the name for the new index

Step 5 : Synchronize the AOT

2. Allowable data types for an index may include:

( ) String, Integer, Real, and Container ( ) String, Enumerated, Real, and Memo (•) String, Integer, Real, and Enumerated ( ) Memo, Container, Map, and integer

3. Nodes required to define a table include: (Mark all that apply.) (Select all that apply.)

(√) Fields (√) Field Groups ( ) Maps ( ) Enumerated data types

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement

Development I in Microsoft Dynamics® AX 2009

2-50

Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement


Recommended