Documente Academic
Documente Profesional
Documente Cultură
Introduction
This chapter discusses how to develop the user interface without writing a single line of code. Forms are created to make it possible for the end user to enter and view data. To make navigation easier for the end user, menus and menu items will be created. Different options for obtaining help will be examined. First the Project tool that helps organize the MorphX objects that will be worked will be discussed to help build good development organization and practices.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-1
Projects
Projects organize new or customized application objects. Think of a Project as a reference folder for related objects. The project keeps related objects together in a container to help organize and identify items that are part of a customization or modification. Even though objects can be accessed through projects, they reside in their original location in the AOT. Projects are like a shortcut to application objects.
Creating Projects
Project containers are not visible within the AOT. They are stored in their own object tree. To access projects in Microsoft Dynamics AX 2009, use the Project icon on the toolbar as shown in the Figure.
3-2
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The project tree is divided into Private and Shared branches: 1. Private - Only visible to the user who created them 2. Shared - Visible to all users of the specific application
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-3
FIGURE 3.3
Forms
Forms are the primary method of interaction between Microsoft Dynamics AX 2009 and a user. An understanding and exploration of existing forms will allow the development of new forms to retain the same look and feel as standard Dynamics AX 2009 forms.
3-4
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
To examine these categories, open the AOT and locate the CustTable form within the Forms branch of the AOT and expand the CustTable form node as shown in the Figure.
Form Designs
To understand Forms and their design, examine a form at run-time in the application. Some forms can be opened directly from the AOT, whereas other forms rely on information passed to it before they can open. This section works with the CustTable form, which can be opened directly from the AOT.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-5
Notice there is a Data Grid for the tab labeled Overview in the Customer form. This form is composed of nine tab pages, arranged on the top of the form and nine command buttons or button groups arranged at the right side. After viewing the CustTable form, open the Designs branch and compare the objects residing within it versus the Form. Navigate to the Design branch of the CustTable form in the AOT as shown below.
The groups of objects are Tab and ButtonGroup. These are referred to as controls or form controls. To view all the available controls, right-click the Design node and select New Control.
3-6
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The branches of the Design branch show all the controls that belong to the CustTable form; there are eight Tab controls and seven Buttons. The names of the controls and labels displayed on the CustTable form match what appears in the AOT. As a last examination of this design, expand the Tab Page branch labeled Overview under the Tab branch. This reveals all the objects on the first tab page of the customer form. A data grid or Grid control exists with its attached data columns. Later in this section, you design a simple form, learn how to add controls, and assign them to Data Sources.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-7
Open the Data Source for the CustTable form and view its Properties sheet to view which Property values are typically assigned when constructing a Data Source. The Property sheet lists useful Properties for the CustTable data source on the CustTable Form. For example, the AllowCreate and AllowDelete properties control whether new rows can be created or old rows deleted from the customer form. The Table property specifies which table the data source is based on (in this case, the CustTable). The Index Properties controls what index is used for sorting data within the Form. More than a single Data Source can be used on a Form; the linking of data between sources is performed by using the JoinSource Properties. This allows for any level of custom form design. Joining data sources on a form is examined later in this chapter.
3-8
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The init method executes when the form initializes. The close method executes just before the form closes. The ClassDeclaration method is a constructor that defines what classes the form can access. The numberSeqFormHandler method involves calling the class by the same name.
When you create a new form, understanding how to program these methods is not required, Microsoft Dynamics AX 2009 handles them automatically. The custom modification of these methods is beyond the scope of this manual as it involves knowledge of X++ and will be handled in the next class.
Creating Forms
To enter, edit, or delete data in a table from the user interface it must have an accompanying Form. When a new Form is created, MorphX automatically generates a visual layout. Microsoft Dynamics AX 2009 uses the information from its data sources to accomplish this auto-generated layout. In many cases, the system-generated layout is ready to use, but can be modified if it is required. BEST PRACTICES: Use a Project to collect all related development in a central location. This practice will allow the developer to ensure that all components are exported as a unit.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-9
3-10
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Delayed
Active
InnerJoin
OuterJoin
ExistJoin
NotExistJoin
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-11
3-12
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-13
6. Modify the properties of the DateEdit component on the form. Set the DateValue property to date. 7. Use the Find Label dialog to find the label Today and set it as the Label property for the new DateEdit control.
3-14
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Forms Creation
Create a new Form accessing the CustTable table called CustTest. Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.
The final form when it is compiled and saved should resemble this form:
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-15
Challenge Yourself!
Create a new Form in Microsoft Dynamics AX 2009 that has the following requirements Properties: Uses the customer table CustTable as the Data Source. Use a Tab in your design. Add a Tab Page to your Tab. Use a Grid control as the Tab Page. The following columns should be on your Grid - AccountNumber and Name. Label the Tab Page as Customer Info. Set the Caption Properties of your design to @SYS19920 using the label finder. There is a Properties named TitleDatasource which must be set for the Caption to operate correctly. Set it to your Data Source. Name your new form to CustTest.
3-16
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
FIGURE 3.15
Step by Step
Solution
1. Right-click the Forms node in the AOT and select New Form. 2. Right-click the NewForm1 and Rename it CustTest. 3. Expand the CustTest form node and right-click Data Sources and select New Data Source. 4. Right-click DataSource1 and select Properties to open the Properties sheet. 5. Set the Table Properties to CustTable. Close the Properties sheet. 6. Expand the Designs node, right-click the Design branch, and select New Control and Tab. 7. Right-click the Tab branch and select New Control and TabPage. 8. Expand the Tab branch, right-click TabPage:TabPage, and select New Control and Grid. 9. Right-click the Grid: Grid branch and select New Control and StringEdit. 10. Repeat step 9 to create a second field. 11. Right-click the StringEdit:StringEdit branch and select Properties to open the Properties sheet. Set the DataSource property to DataSouce1 and the DataField property to AccountNum. 12. Right-click the StringEdit1:StringEdit1 branch and select Properties to open the Properties sheet. Set the DataSource property to DataSuouce1 and the DataField property to Name.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-17
3-18
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
There are three types of menu items that can be created: Display Output Action
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-19
3-20
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
There are two important Properties to notice. Class property = Form Object property = CustTable
The Class property sets the class of item that appears, whereas the Object property is the name of the object itself. When you open the menu item, a form named CustTable opens.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-21
FIGURE 3.18
The new menu item is now available to be added to a new or existing menu.
3-22
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The figure illustrates the form that enables the outputting of the Customer Turnover report (CustRevenue).
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-23
There are two important properties to notice. Class property = Class Object property = CustReport_Revenue
The CustRevenue Output Menu Item directly calls the class named CustReport_Revenue.
3-24
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The property sheet of an action menu item is structurally identical to an Output menu item.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-25
The Cust menu in the AOT represents the accounts receivable menu. Recall this menu is a part of a larger menu, the MainMenu. To understand how these menu objects interact, expand the Menus node in the AOT as shown in the following figure.
3-26
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The small arrow on the folder indicates that these are menu references for the Microsoft Dynamics AX 2009 Navigation Pane. If you view the properties for the Accounts receivable menu reference in the MainMenu, note the object name of the menu is Cust. The menu reference points to the Cust menu. Locate the Cust menu and open its node. Notice you are viewing the objects that are seen from the Accounts receivable menu of Microsoft DynamicsAX 2009. The Cust menu consists of the following submenus: Journals Inquiries Reports Periodic Setup
The visible menu items shown within the parent menu are as follows: Sales order Free Text Invoice Customers
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-27
2. Assign the MenuItemName property ZipMenuItem. The properties associated with ZipMenuItem such as Label and Object Properties are inherited. 3. To test the menu item highlight it and open it. Verify it contains the ZipCodes form. A quicker alternative for adding a menu item to an existing menu is using the drag and drop functionality in MorphX. Drag the menu item onto the specified menu.
3-28
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-29
Places
Places is a new functionality in Dynamics AX 2009 located within the Navigation Pane. The Places section contains an Area Page link and links to Menu Items that have been appropriately designed. Clicking on a Menu Item other than the Area Page, in the Places section of the Navigation Pane will launch that Menu Item as either a List Page or as a Single Document Interface (SDI) form.
3-30
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
NOTE: Single Document Interface (SDI) forms are one of the biggest changes to the user interface in Dynamics AX 2009. In previous versions of Dynamics AX 2009 all forms were Multi-Document Interface (MDI) forms. The advantage of SDI forms is that they located outside of the Content Frame as a separate Window.
Forms
Forms is a new section within the Navigation Pane that contains links to all other Menu Items that are not set to be displayed in Places.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-31
The Area Page can be used as an alternate means of navigating through the system as it displays all of the forms that are listed within the Navigation Pane. The Area Page cannot be developed. It is generated by Dynamics AX 2009 using the structure of the menu that is displayed. An Area Page and its link will be created automatically whenever a new menu is created in the AOT. NOTE: List Pages are a new type of form that will display read-only lists within the Content Frame. List Pages are beyond the scope of this course, and are addressed in a more advanced course.
3-32
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Your completed menu item, when it is opened, contains the CustTest form.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-33
Challenge Yourself!
Requirements of this exercise are the completion of a new menu item with the following Properties: Menu Item opens the CustTest form that you created in the previous exercise Select the appropriate type of menu item Select the correct object class and object Name and label the new menu item CustTest Put the new menu item on the Accounts Receivable menu, located below the Customers form
Your completed menu item, when it is opened, contains the CustTest form.
Step by Step
Solution
1. Expand the Menu Items node in the AOT. Right-click the Display node, and select New Menu Item. 2. Open the Property sheep and set the Class property to Form. 3. Set the Object property to CustTest. 4. Set the Name and Label Properties to CustTest. 5. Right-click the CustTest branch under the Display node and select Save. 6. Right-click the CustTest branch under the Display node and select Open. 7. Your CustTest Form should open. 8. In the AOT, expand the Menus node and locate the Cust menu and expand. Right-click the Cust menu and select New then Menu item. 9. Open the properties for the new menu item. The MenuItemType should be Display and the MenuItemName should be CustTest. 10. Position the new CustTest menu item below the Customers menu item. 11. When you now open the Navigation Pane your CustTest menu should be available in Accounts Receivable.
3-34
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Classes
Classes have the following characteristics: Classes allow reuse common functionality or business logic. Classes are a design or blueprint for a programming object. After a set of Classes is defined, they can be used programmatically from all the other application objects. Classes can be run directly from the AOT if a Main method is defined, although this is not a common practice. Classes are used for solving tasks for other application objects, such as forms and reports. Classes in Microsoft Dynamics AX 2009 share the same attributes a class in C# has, such as inheritance, polymorphism, and encapsulation.
You may be tempted to start with coding as the first step. This approach is not ideal in a Microsoft Dynamics AX 2009 application because code runs in the context of an application object and an associated event. A class contains all the properties, methods, and variables needed by an object. A class can be created by right-clicking the Classes node of the AOT, and selecting New class or by using the Class Wizard located in the Tools menu.
Class Methods
When developing a class it contains three nodes by default: The Class Declaration node specifies the name of the class and the necessary variables. It can also specify inheritance.
NOTE: Class Declaration is not a method. It is a class-level scope area that defines global variables for all methods within the class.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-35
Classes are covered in detail in the course Development II: Introduction to X++, and are beyond the scope of this tutorial on MorphX.
Macros
Macros act as a container for defining variables used for frequent tasks. The purpose of macros is to make statements easy to reuse. A macro cannot be executed independently of a class. They serve in the same manner a header file might serve for data structure definition, because they provide definition values of Properties associated to an object. An example of a Macro is a File macro. The File macro provides: Definitions of file extensions Input/Output definitions XML file definition Delimiter information
A sample of a macro named File is shown in the following figure that describes file extensions. File extensions are definitions for objects in Microsoft Dynamics AX 2009 that must use files. This macro enables file extensions to be defined in a single central location, where all file aware classes can have use of it.
The macros node in the AOT contains macros used by the standard application. Here are some key points of macros. They can be declared wherever you can write X++ statements and contain code that can be useful in several places. An advantage of defining a macro is that the maintenance is done in only one place. A macro cannot run independently, but can be used anywhere you can write code in the system, such as in jobs, classes, and forms.
3-36
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
All types of packaging have identical syntax and functionality. The differences between the packaging are: A standalone macro is created by using the macro node of the AOT. A local macro is declared within a method or stand-alone macro. A macro library is a standalone macro that contains a collection of local macros.
Generally, define a class instead of writing macros for work involving statement logic. Macros are covered more in detail in advanced classes in X++ and MorphX development.
Jobs
The jobs node on the application object tree contains small X ++ programs that are executed as batch jobs. They are useful when developing and testing new functionality for Microsoft Dynamics AX 2009. The jobs node on the AOT is empty after installing and configuring the Microsoft Dynamics application. These batch jobs can be scheduled to run at specific times.
Create a new job by selecting New Job when right-clicking on the Jobs node in the AOT. The Job skeleton named Job1 is created. Use the Edit method from the MorphX right-click menu to create new X++ code you can test or modify existing code within a job.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-37
Jobs have the following characteristics: When testing new code, jobs save development time by eliminating creating a new class and defining a new method. A job is a static method that returns nothing and can be attached to a form for testing. They are primarily used in the production environment only to run batch work in the background.
Microsoft Dynamics AX 2009 includes several batch processes already a part of the system. Jobs are discussed in Development II.
Queries
Queries ask questions about data stored in a database. The information selected by a query can be used as the basis for a form, auto report, or another query. The query extracts data from a database and presents it in a form for viewing. Although the query does not provide a graphical viewing interface, Microsoft Dynamics AX 2009 provides a specialized form named a query dialog form.
3-38
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The Asset Proposal query uses the AssetBook and AssetTable tables as its data source. Basic components of a query are composed of: Methods Data Sources
Data sources have their own field objects and methods such as sorting. A query resembles a view except it is not static because it can be modified at run time. Often, queries are used behind the scenes and are never viewed by the user. This is the case when X++ based queries set the position of a data source on a form. Query objects that are created in the AOT can be viewed by using the query dialog form. The query dialog form in this section is a system form named SysQueryForm. The SysQueryForm is the standard form used by Microsoft Dynamics AX 2009 for presenting graphical dialog boxes that enable the design and modification of queries by the end user. To show how the query is linked to the SysQueryForm, view the properties sheet of the AssetProposal query. Open the Asset Proposal query so for analysis in the query dialog form.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-39
The query dialog shown in the proceeding figure is the result of the query design.
3-40
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
The Data Sources branch refers to tables that are used by the query; Ranges refers to the fields available to the query dialog form. The data sources and Relations objects together form all the possible fields available to the query. Fields in the Ranges branches appear in the query Dialog design form when it opens. The design of a query at runtime is a temporary change that is not stored after the design change occurs. The user can add different tables, table joins, fields, field criteria, and have their custom design run one time.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-41
4. Open the query to view its results. Set the criteria field for GiftIdea. 5. Set the Criteria property to the value of Theater Tickets using the drop-down menu on the query dialog form. The Customer Tickets query is finished and can be used in a report that shows customers who wants theater tickets as a gift.
Help Documentation
Microsoft Dynamics AX 2009 2009 includes a Help system that is based on Compiled HTML Help files (chm files). The Help system can be accessed from Microsoft Dynamics AX 2009 to provide assistance with the application; however, it is also available from outside the application. The help system is spilt into several files to reflect the job roles associated with Microsoft Dynamics AX 2009. Each Help file is editable by using a Chm file tool such as HTML Help Workshop. The same tool can be used for creating new Help files for Partner Solutions. Chm files do not have to be indexed or initialized during installation. This can save time. The Help files are continuously updated and made available for download.
3-42
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Application Documentation
The Microsoft Dynamics AX 2009 application documentation is located under the Application documentation node and contains reference documentation for the Microsoft Dynamics AX 2009 application. Documentation is also available on forms in the application.
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-43
NOTE: You can check if there is an updated version of the Help file. Just click Check for Updates on the Help menu. You can also check this site for more information: http://www.microsoft.com/dynamics/ax/using/default.mspx
Summary
This course discussed how to develop the user interface without writing a single line of code. This course also made it possible for end users to enter and view information using Forms that were created. To make navigation easier for the end user, menus and menu items were created. Different options for obtaining help were examined. Tools such as the Project Tool were reviewed to help organize the MorphX objects that were worked upon. The next course examines the Report functionality in Microsoft Dynamics AX 2009.
3-44
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-45
2.
3.
3-46
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
Solutions
Test Your Knowledge
1. The three (3) elements for a Form include: ( ) Methods, Data Sources, and Views () Designs, Methods, and Data Sources ( ) Display Menu Items, Data Sources, and Designs ( ) Jobs, Menu Items, and Macros 2. The Area Pages can be customized by: ( ) Making changes to the Areas node in the AOT () By making changes to the Menus that the Areas page will automatically be generated from ( ) By setting the IsDisplayedInContentArea property of the Navigation Pane ( ) The Area Pages cannot be changed 3. Available Project types available are: Mark all that apply. (Select all that apply.) () Project ( ) Help Project () SysTestProject ( ) Test Project 4. Available Menu Items are: Mark all that apply. (Select all that apply.) () Display Menu Items () Output Menu Items ( ) Project Menu Items ( ) Report Menu Items
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement
3-47
3-48
Microsoft Official Training Materials for Microsoft Dynamics Your use of this content is subject to your current services agreement