• Like
  • Save
Na2009 enus devi_03
Upcoming SlideShare
Loading in...5
×
 

Na2009 enus devi_03

on

  • 309 views

 

Statistics

Views

Total Views
309
Views on SlideShare
309
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution-NonCommercial LicenseCC Attribution-NonCommercial License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Na2009 enus devi_03 Na2009 enus devi_03 Document Transcript

    • Chapter 3: FormsCHAPTER 3: FORMSObjectives The objectives are: • Understand the concepts of forms and form components. • Create a simple form and add basic controls to the form. • Provide an overview of different form types and their characteristics. • Create a Card form. • Create a List form. • Link a Card form and a List form. • Create a main form and a subform. • Understand the concept of standard navigation between forms.Introduction Forms are used for entering information into database tables and for retrieving and displaying information from database tables. Compared to programs written in traditional programming languages, C/SIDE applications do not execute sequentially. They are event-driven. A major part of the logic of the applications rests with the forms. It is through forms that users generate events that determine the flow of the application. Forms are used in the Microsoft Dynamics® NAV Classic client. Microsoft Official Training Materials for Microsoft Dynamics ® 3-1 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009Form Fundamentals Forms can be used to access one table at a time, or they can combine information from several tables. A form can also display information that is calculated as the form is displayed, and it can also contain information that is not related to any table, such as labels or bitmap pictures. These are purely decorative. The following figure shows components of a form and how they are related: FIGURE 3.1 FORM COMPONENTS AND THEIR RELATION Properties Form properties are used to define the behavior of the forms. For example, form properties such as InsertAllowed, ModifyAllowed and DeleteAllowed, specify whether a form must be used only for displaying information or whether it is possible to insert new records, update or delete existing records through the form. Form properties are defined on the Properties window that can be edited when the form is opened in the Form Designer. The following steps show how to open the Properties window for the Customer Card form. In Microsoft Dynamics NAV Classic client: 1. On the Tools menu, click Object Designer. The Object Designer opens. 2. Click the Form button to open the Form list. 3. Select form 21, Customer Card, and then click the Design button to design the Customer Card form. The Form Designer opens. 4. Click anywhere outside the form, or click somewhere at the empty area inside the form, but not in any of the controls, and then click View, Properties, or click the Properties button on the Toolbar. NOTE: Alternatively, right-click anywhere outside the form, or somewhere at the empty area inside the form but not in any of the controls, and then click Properties.3-2 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 5. The Form - Properties window opens and shows the properties for the form. Here developers can view and modify properties for the Customer Card form. FIGURE 3.2 THE CUSTOMER CARD FORM AND ITS PROPERTIES Triggers Certain predefined events that occur to a form or a control cause the system to execute a user-definable C/AL function. The event and the function together are called a trigger. Triggers in a form can be divided into two categories: • Form triggers • Control triggers Examples of form triggers include OnOpenForm which contains statements that are executed when the form is opened, and OnModifyRecord which contains statements that are executed before the system accepts changes the user makes to a record. Triggers in a form are edited in the C/AL Editor which is accessed from the Form Designer. Controls All information on a form is presented by using controls. Controls display data from the following: • A database table field. • The value of a C/AL expression. • Bitmap pictures. • Static information such as a descriptive text. Microsoft Official Training Materials for Microsoft Dynamics ® 3-3Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 There are several kinds of controls that can be added to a form. The following list groups controls into several broad categories. Control Type Description Static Static controls contain and display descriptive text or Controls graphical information. The contents of static controls cannot be changed at run time. Example: Label, Image, Shape. Data Controls Data controls display the value of a C/AL expression. The simplest expression is the name of a table field or a variable. Example: Check Box, Option Button, Text Box, Picture Box, Indicator. Containers Container controls group other controls together. Some properties of the container overrule the same property in the contained controls. If the container cannot be edited, then none of the contained controls can be edited, even if they have their Editable property set to Yes. Example: Frame, Tab Control. Data Data Containers are special kinds of containers that hold Containers repeated data controls and are used to create columnar tables. Each data control that is contained by the data container makes up one column for which a static control is used as a heading. The rows are created by vertically repeating each data control. If the data container displays records from a table, each row displays one record. Example: Table Box. Command A command button is not related to data. It performs an action Button when it is clicked, or when ENTER or the spacebar is pressed while the button has the focus. Menu Button A menu button can be clicked exactly like a command button. However, it does not perform an action. When it is clicked, a menu opens showing several menu items. Menu Item The lines in a menu that are opened from a menu button are known as menu items. Each menu item can be clicked and resembles a command button because it performs an action when it is clicked. Subform Subforms display another form in a control on the main form. This lets the main form show data from two tables. For example, the main form is a card form and shows information about a customer from the customer table, whereas the subform is a tabular form and shows details of purchases made by the customer.3-4 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Control Properties Control properties describe how a control is positioned on the form, what field that it is related to, and other behavior of the control. Different kinds of controls have different sets of properties. For example, a text box, a control type that is typically used to display the contents of a database field, has more properties than a picture box, a control that is used to display bitmap pictures. The following steps show how to open the Properties window for one of the controls (the Customer menu button) in the Customer Card form. 1. Design form 21, Customer Card, from the Object Designer. 2. Click the Customer menu button and then click View, Properties, or click the Properties button on the Toolbar. NOTE: Alternatively, right-click the Customer menu button and then click Properties. 3. The MenuButton - Properties window opens and shows the properties for the control. Here developers can view and modify properties for the Customer menu button. FIGURE 3.3 THE CUSTOMER MENU BUTTON PROPERTIES Control Triggers Control triggers describe what happens when certain events occur with regard to the control. For example, when a command button is clicked or when information is entered into a text box. The following steps show how to view the triggers for the Contact menu item on the Customer menu button, in the Customer Card form. 1. Design form 21, Customer Card, from the Object Designer. 2. Click the Customer menu button and then click View, Menu Items. The Menu Designer for the Customer menu button opens. Microsoft Official Training Materials for Microsoft Dynamics ® 3-5Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 NOTE: Alternatively, right-click the Customer menu button and then click Menu Items. 3. Click the Contact menu item and then click View, C/AL Code, or click the C/AL Code button on the Toolbar. The C/AL Editor opens and shows the triggers for the Contact menu item. Here developers can write C/AL statements to program certain activities when any particular trigger is executed, for example, when the Contact menu item is clicked. NOTE: The triggers for the Customer Card form are also shown together with the triggers for the Contact menu item. FIGURE 3.4 THE CONTACT MENU ITEM TRIGGERS AND THE CUSTOMER CARD FORM TRIGGERS Bound and Unbound Forms and Controls Typically, a form is related to a database table and is used to enter information into and display information from that table. The form is said to be bound to the table. An unbound form is not related to any table. An example of an unbound form is a form that is used as a menu, from which the user can select other forms or reports to run. NOTE: Menu forms are no longer part of the base product but can still be developed in Microsoft Dynamics NAV. The controls on a form that are bound to a table are usually bound to fields in the same table. There need not be a control for every field in the table, nor do all controls on the form need to be bound to table fields. Controls that are not bound to fields are called unbound controls. An example of an unbound control is a command button.3-6 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms The Customer Card Form The Customer Card form is a bound form. As the name suggests, it is bound to the Customer table. FIGURE 3.5 THE CUSTOMER CARD FORM The Customer Card form has a tab control, grouping several other controls to six different tabs (General, Communication, Invoicing, Payments, Shipping and Foreign Trade). There are several labels and text boxes in the General tab and several check boxes in the Invoicing, Payments and Shipping tabs. The Customer Card form has three menu buttons (Customer, Sales and Functions), each containing menu items, and a command button (Help). The Customer List Form The Customer List form is also a bound form that is bound to the Customer table. FIGURE 3.6 THE CUSTOMER LIST FORM Microsoft Official Training Materials for Microsoft Dynamics ® 3-7Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 The Customer List form has a table box that contains several text boxes which are repeated for each row, and labels, one for each column. It has two menu buttons (Customer and Sales) and three command buttons (OK, Cancel and Help).Demonstration: Create a Simple Form The following demonstration shows how to add basic controls from the Toolbox to a form, and how they are used together with several of their properties. Create a Blank Form The following steps show how to create a blank form. 1. In the Object Designers Form list, click the New button. The New Form window opens. 2. Select Create a Blank Form and then click OK. The Form Designer opens. NOTE: When a blank form is created, the size of the designer is small. This can be enlarged if it is necessary. 3. Compile and save the form by clicking File, Save As. The Save As dialog box opens. 4. Type 90000 in the ID and Blank Form in the Name, ensure that the Compiled check box is selected, and then click OK. This compiles and saves the form. 5. Close the form by closing the Form Designer. 6. In the Object Designers Form list, select form 90000, Blank Form, and then click the Run button to run the newly created Blank Form. FIGURE 3.7 THE BLANK FORM 7. Close the form.3-8 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Attach a Source Table A blank form is unbound when it is created. It is not associated with any table. The following steps show how to associate a blank form with a table. 1. Design form 90000, Blank Form, from the Object Designer. 2. Open the Properties window for the form, and set the following property: o SourceTable: Customer FIGURE 3.8 THE FORM PROPERTIES NOTE: SourceTable property accepts either the ID or the name of the table. 3. Close the Properties window. 4. Compile, save and close the form. 5. Run form 90000, Blank Form. Notice the value that is shown in the title bar of the form. 6. Click the Next button on the Toolbar. Notice the value that is shown in the title bar now. 7. Close the form. The Blank Form is now attached to the Customer table. When the Next button is clicked, the Blank Form shows the next customer record in the Customer table, although in this case, there are no controls available in the form to show any information from the customer record. Microsoft Official Training Materials for Microsoft Dynamics ® 3-9Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Add a Text Box The Blank Form is useless without any controls in it. The following steps show how to add a text box to the blank form. 1. Design form 90000, Blank Form, from the Object Designer. 2. Click View, Toolbox or click the Toolbox button on the Toolbar. The Toolbox opens. FIGURE 3.9 THE TOOLBOX 3. Rest the mouse on each button on the Toolbox for several seconds to view the Tool Tip for each button and to become familiar with what each button represents. 4. Click the Text Box button on the Toolbox. 5. Move the cursor over the form, and then click somewhere in the middle of the form. Notice that the cursor changes to cross hairs and a box when it is moved over the form. The upper-left corner of the text box is where the form was clicked. FIGURE 3.10 THE BLANK FORM WITH A TEXT BOX3-10 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Bind the Text Box The text box must be bound to a field or another data element. This can be anything that returns a valid value: variables, functions, or other expressions. 1. Open the Properties window for the text box, and set the following property: o SourceExpr: "No." 2. Close the Properties window. 3. Compile, save and close the form. 4. Run the form, and test the new text box by moving to the next, previous, first, or last record. FIGURE 3.11 THE BLANK FORM WITH A TEXT BOX Add a Label At this point, it is not clear what information the text box provides. To help the users, add a label that describes the field on the form. The following steps show how to add a label to the form. 1. Design form 90000, Blank Form, from the Object Designer. 2. Open the Toolbox and then click the Label button. 3. Move the cursor over the form, and then click somewhere to the left of the text box. Re-position the text box and the label if it is necessary. 4. Change the Caption property of the label to No. 5. Compile, save and close the form. Microsoft Official Training Materials for Microsoft Dynamics ® 3-11Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 6. Run the form, and test the new text box by moving to the next, previous, first, or last record. FIGURE 3.12 THE BLANK FORM WITH A TEXT BOX AND A LABEL The label indicates that the text box is looking at the No. (number) field from the Customer table. Add a Check Box The following steps show how to add a check box to the form. 1. Design form 90000, Blank Form, from the Object Designer. 2. Open the Toolbox and then click the Check Box button. 3. Move the cursor over the form, and then click somewhere in the middle of the form under the text box. NOTE: For a check box to work correctly, the expression or field that it is bound to must return a Boolean value (true or false). A check mark in the check box represents true, and an empty check box represents false. 4. Adjust the width of the check box to the right side. 5. Open the Properties window for the check box, and set the following properties: o SourceExpr: "Print Statements" o ShowCaption: Yes NOTE: A check box has a built-in label. Therefore, there is no need to add one separately. By default, the built-in label for a check box is displayed on the right side of the check box.3-12 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 6. Close the Properties window. 7. Compile, save and close the form. 8. Run the form, and test the new check box by moving to the next, previous, first, or last record. FIGURE 3.13 THE BLANK FORM WITH A CHECK BOX Use the Add Label and the Lock Option There are two useful options on the bottom of the Toolbox that help in designing forms. The first is the Add Label that enables developers to attach a label automatically when placing another type of control, such as a text box, onto the form. The second is the Lock. This enables developers to quickly add more than one control at a time. The following steps show how to use the Add Label and the Lock. 1. Design form 90000, Blank Form, from the Object Designer. 2. Open the Toolbox and then click the Add Label button. 3. Click the Text Box button. Microsoft Official Training Materials for Microsoft Dynamics ® 3-13Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 4. Move the cursor over the form, and then click somewhere in the middle of the form under the other controls. Notice that a label is automatically added alongside the text box. Also notice that the Text Box button is automatically un-clicked. FIGURE 3.14 TEXT BOX ADDED BY USING THE ADD LABEL NOTE: Labels added by using the Add Label, have their ParentControl property set to the ID of the parent control. 5. Click the Text Box button and also click the Lock button. 6. Move the cursor over the form, and then click somewhere in the middle of the form under the other controls. Notice that not only a label is added alongside the text box, but also the Text Box button and the Lock button remain clicked.3-14 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 7. Move the cursor over the form, under the previous control and click the form several times to add more text boxes. The Add Label and Lock option enables developers to efficiently add multiple controls to the form. FIGURE 3.15 TEXT BOXES ADDED BY USING THE ADD LABEL AND THE LOCK 8. Close the form without saving it. Add a Tab Control Container controls allow for the grouping of other controls and organize how information is presented in a form. The following steps show how to add a tab control and then to add new tabs into the tab control. 1. Create a new form, and attach the Item table as the source table. Compile and save it as form 90001, Custom Form. NOTE: When creating a new form, typing Item in the Table field in the New Form window sets the source table of the new form to Item table automatically. 2. Open the Toolbox and then click the Tab Control button. 3. Move the cursor over the form, and then click somewhere in the top left area of the form. Microsoft Official Training Materials for Microsoft Dynamics ® 3-15Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 NOTE: The form has only one tab. The name of the first tab is General. This name is a standard for forms that have tabs. FIGURE 3.16 THE CUSTOM FORM WITH A TAB CONTROL 4. Open the Properties window for the tab control, and locate the PageNames property. NOTE: The current value of the PageNames property is <General> (the name of the first tab). The PageNames property is a comma-separated list of tab names. To add a tab, add to this list. Press the F2 key to reach the end of a selected field. 5. Set the following property: o PageNames: General,Test,Frame,Table Box,Picture NOTE: There are no spaces after the commas in the PageNames property. If spaces exist after the comma, they will become part of the tab names. 6. Close the Properties window. Add Controls to a Tab 1. Click the Test tab of the tab control. 2. On the Toolbox, click the Label button.3-16 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 3. Move the cursor over the form, and then click somewhere in the middle of the form inside the Test tab. FIGURE 3.17 THE CUSTOM FORM WITH A LABEL 4. Compile, save and close the form. 5. Run the form, toggle between the General and Test tab and view the changes. Add a Frame A frame is similar to the page of a tab control, it holds other controls. When the frame is moved, the controls inside the frame stay with it. The following steps show how to add a frame. 1. Click the Frame tab of the tab control. 2. On the Toolbox, click the Frame button. 3. Add a frame to the Frame tab. Re-size the frame so that it fits inside the tab control. 4. Change the Caption property of the frame to Test Frame. Microsoft Official Training Materials for Microsoft Dynamics ® 3-17Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 5. Add several labels to the frame. Remember to drop the controls inside the frame. FIGURE 3.18 THE CUSTOM FORM WITH A FRAME Add a Table Box A table box is a container control that contains bound controls. It enables the form to display more than one record at a time. The following steps show how to add a table box to show multiple item records. 1. Click the Table Box tab of the tab control. 2. On the Toolbox, click the Table Box button. 3. Add a table box to the Table Box tab. Move it to the upper-left corner and resize it to fit the tab control. NOTE: The table box is currently empty. It is a container control, and other controls must be added to it. The most common control in a table box is a text box. 4. On the Toolbox, click the Text Box button. 5. Move the cursor over the form, and then click somewhere inside the table box. The text box becomes a column and a label is added to the top for a column heading.3-18 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 6. Change the SourceExpr property of the text box (the column) to "No." FIGURE 3.19 THE CUSTOM FORM WITH A TABLE BOX 7. Compile, save and close the form. 8. Run the form, and view the table box inside the Table Box tab. The table box displays several rows of records from the item table. There is a triangle in the gray box next to the current row. The title bar of the form changes according to the row selected in the table box. When the form is maximized or adjusted, the controls all stay the same size and in the same location. Autosizing Controls The tab control must grow together with the form, when the form is adjusted. This must also be the case with the table box. The HorzGlue and VertGlue properties of the controls determine this behavior. The following steps show how to set up the HorzGlue and VertGlue properties. 1. Design form 90001, Custom Form, from the Object Designer. 2. Open the Properties window of the tab control, and set the following properties: o HorzGlue: Both o VertGlue: Both NOTE: If the Frame and Table Box tabs disappear when this property is modified, complete the next step, and then compile, save and close the form. When the form is reopened in the Form Designer, the tabs will be there, and the properties will be set. 3. Close the Properties window. Microsoft Official Training Materials for Microsoft Dynamics ® 3-19Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 4. Open the Properties window of the table box, and set the following properties: o HorzGlue: Both o VertGlue: Both 5. Compile, save and close the form. 6. Run the form, and adjust the form width and height, or maximize the form. The tab control and the table box grow with the form. Display an Option Field Option fields can be displayed to the user in two ways, by using a text box or option buttons. The following steps show how to display an option field by using both ways. 1. Design form 90001, Custom Form, from the Object Designer. 2. Click the General tab of the tab control. 3. Open the Toolbox, click the Add Label button and then click the Text Box button. 4. Add a text box with an attached label to the General tab. 5. Change the SourceExpr property of the text box to "Costing Method". NOTE: The Costing Method field is an option field in the Item table. 6. On the Toolbox, click the Lock button and the Option Button button. 7. Add three option buttons underneath the text box, without attached labels. NOTE: There are five option values for the Costing Method field. The option values are indexed starting from 0. In this demonstration, only three option buttons are created, therefore, the users will only be able to access three of the values. 8. Set the following properties for each option button: o For the first option button: – SourceExpr: "Costing Method" – OptionValue: FIFO – Caption: FIFO3-20 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms o For the second option button: – SourceExpr: "Costing Method" – OptionValue: LIFO – Caption: LIFO o For the first option button: – SourceExpr: "Costing Method" – OptionValue: Standard – Caption: Standard NOTE: To effectively change properties for multiple controls, keep the Properties window open, and then click one control at a time. The Properties window automatically shows the property for the control that is clicked. FIGURE 3.20 THE CUSTOM FORM THAT DISPLAYS AN OPTION FIELD BY USING TEXT BOX AND OPTION BUTTONS 9. Compile, save and close the form. 10. Run the form, and view several items with different costing methods. The text box displays a drop-down list, listing all the options available for the option field. If an item with Standard costing method is displayed, the Standard option button is selected. This is also the case for items with the FIFO and LIFO costing method. Only one of the option buttons can be selected at any point of time. If an Item with Average costing method is displayed (for example, item 80100, Printing Paper), none of the option buttons are selected, because there is no option button created for Average costing method. Microsoft Official Training Materials for Microsoft Dynamics ® 3-21Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Display a Progress Indicator An indicator creates a way for the user to easily view the percentage of a value in a graphical manner. The following steps show how to display the profit of an item by using an indicator. 1. Design form 90001, Custom Form, from the Object Designer. 2. Open the Toolbox, click the Indicator button. 3. Add an indicator to the General tab. NOTE: By default, an indicator starts from the left side and increases to the right side. 4. Set the following properties for the indicator: o Orientation: Bottom o MinValue: 0 o MaxValue: 100 o SourceExpr: "Profit %" 5. Increase the height of the indicator by dragging the top edge and decrease the width by dragging the left edge. 6. Compile, save and close the form. 7. Run the form. FIGURE 3.21 THE CUSTOM FORM WITH AN INDICATOR Display a BLOB Field (Picture) Binary Large Object (BLOB) fields are primarily used to store pictures. Some items in the Item table have pictures. The following steps show how to display a BLOB field to display a picture of an item by using a picture box. 1. Design form 90001, Custom Form, from the Object Designer. 2. Click the Picture tab of the tab control.3-22 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms 3. Open the Toolbox, click the Picture Box button. 4. Add a picture box to the Picture tab. Move the picture box to fit inside the tab control. 5. Change the SourceExpr property of the picture box to Picture. 6. Compile, save and close the form. 7. Run the form. 8. Use the Next button to examine different records. List some items that have pictures. HINT: Start to look from item 1896-S, ATHENS Desk. FIGURE 3.22 THE CUSTOM FORM WITH A PICTURE BOX Microsoft Official Training Materials for Microsoft Dynamics ® 3-23Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009Form Types and Characteristics There are five basic kinds of forms in C/SIDE, the development environment for Microsoft Dynamics NAV: • Dialog boxes • Request forms • Unbound forms • One-record forms • Multi-record forms Dialog boxes Dialog boxes are simple windows that display information such as error or message text. The only user interaction is to click a button, such as OK, Cancel, Yes, or No. These buttons are generated by C/AL functions such as ERROR, MESSAGE, TESTFIELD, and CONFIRM, or are created by using a variable of type Dialog. They are not associated with Form objects. Request Form Request forms are found only within Report objects and are not associated with Form objects. Unbound Forms Unbound forms are Form objects that are not associated with any table. They are mostly used for menu purposes or intermediate means to collect information from users for additional processing. One-Record Forms One-Record forms are Form objects that are associated with a table. They enable the user to view and possibly edit only one record from one table at a time. An example of this is a Card form. Multi-Record Forms Multi-record forms are Form objects that are associated with a table. They enable the user to view multiple records from one table at the same time and possibly edit them. Examples of these include Tabular forms, Trendscape forms, and Matrix forms. While C/SIDE enables developers to create forms of many kinds with different looks and methods of operation, the Microsoft Dynamics NAV application only uses several of the possibilities. This is to provide a consistent appearance to the application.3-24 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Developers may want to follow this policy when modifying forms or applications that interface with Microsoft Dynamics NAV. This makes the application more user-friendly and consistent. All the following descriptions assume full use of the Microsoft Dynamics NAV standards. Form Types and Examples There are several types of standard forms in Microsoft Dynamics NAV. The following list shows the most common form types and some examples of each. Type One Record/Multi- Examples Record Card Form One Record Customer Card, Vendor Card, Item Card Statistics Form One Record Customer Statistics, Vendor Statistics, Employee Statistics Tabular Form Multi-Record Currencies, Payment Terms List Form Multi-Record Customer List, Item List, Item Ledger Entries Worksheet Multi-Record General Journal, Cash Receipts Form Journal, Item Transfer Journal Header/Line Both (actually two Sales Invoice, Posted Purchase Form forms) Credit Memo, Finance Charge Memo Setup Form One Record General Ledger Setup, Company Information, Sales & Receivables Setup Understanding standards forms in Microsoft Dynamics NAV enables developers to understand areas of the application by just a superficial look at the objects. Card Forms A card form enables users to view and edit one record at a time. It is used when there are too many fields to view them all conveniently on only one line. Card forms always have tabs, just as index tabs, across the top edge with which the user can select different groups of fields to display. Even if there are few fields, there is at least one General tab, which is always first. Tables that use card forms only have one field in their primary key and this field is always displayed as the first field in the General tab. Microsoft Official Training Materials for Microsoft Dynamics ® 3-25Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Naming Card Forms Card forms are named with the name of the associated table, followed by the word Card. For example, the card form associated with the Customer table is named Customer Card. Card forms also have at least one menu button at the bottom of the form and this button has the same name as the table that the card form is based on. This button provides ways of accessing information related to that table from the card form. FIGURE 3.23 THE CUSTOMER CARD FORM Statistics Forms A Statistics form is a one-record form that enables users to view, but not edit information. It usually uses FlowFields that let users drill-down for more information. It also contains calculated or derived information that is contained in variables that cannot be drilled-down. Statistics forms may also contain tabs to help organize the information. The primary key of the associated table is displayed in the forms title bar.3-26 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Naming Statistics Forms Statistics forms are named with the name of the associated table, followed by the word Statistics. For example, the Statistics form associated with the Customer table is named Customer Statistics. FIGURE 3.24 THE CUSTOMER STATISTICS FORM Entry Statistics forms are a special version of the statistics form. They are named after the name of the associated table, followed by the words Entry Statistics. For example, the Entry Statistics form associated with the Customer table is named Customer Entry Statistics. Tabular Forms A Tabular form is a multi-record form that enables users to view multiple records from a table and edit them. Each record is displayed as a single row and each field is displayed as a column forming a spreadsheet-like table within the form itself. The primary key of the associated table is displayed in the left-most column. If there are multiple fields in the primary key, they are displayed in order of their significance in the columns, starting from the left. Microsoft Official Training Materials for Microsoft Dynamics ® 3-27Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Naming Tabular Forms Tabular forms are named with the plural of the name of the associated table. For example, the Tabular form associated with the Currency table is named Currencies. FIGURE 3.25 THE CURRENCIES FORM For associated tables that have multiple fields in their primary key, the name can be different. For example, the Tabular form associated with the General Posting Setup table is named General Posting Setup. FIGURE 3.26 THE GENERAL POSTING SETUP FORM3-28 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Worksheet Forms A Worksheet form is a specialized version of the Tabular form. It is also a multi- record form that enables users to view multiple records from a table and edit them. Worksheet forms differ from ordinary Tabular forms, in that when the user inserts a new record, the record does not jump to another position within the form, but instead, the record stays in the same order in which the user inserted it. This order is done by using the AutoSplitKey property of the form, combined with an integer as the last field in the tables primary key. The primary key fields of the associated table are not displayed on the Worksheet form. Naming Worksheet Forms Worksheet forms are named according to the purpose of the associated table. For example, for Journal tables, the name of the Worksheet form ends with the word Journal. FIGURE 3.27 THE GENERAL JOURNAL FORM List Forms A List form is a multi-record form that enables users to view multiple records from a table at the same time, but does not let the user edit them. It uses the same rows and columns look as the Tabular form. The primary key fields of the associated table are displayed in the left-most columns. Microsoft Official Training Materials for Microsoft Dynamics ® 3-29Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Naming List Forms List forms are named with the name of the associated table, followed by the word List. For example, the List form associated with the Customer table is named Customer List. FIGURE 3.28 THE CUSTOMER LIST FORM Ledger Form A Ledger form is a specialized version of the List form. Ledger forms are used only for Ledger Entry tables. They differ from ordinary List forms, in that, even though users cannot insert or delete records, they can sometimes edit a few fields. The primary key of the Ledger Entry tables, an integer named Entry No., is displayed in the right-most column instead of the left-most column. Naming Ledger Forms Ledger forms are named with the plural of the name of the associated table. For example, the Ledger form associated with the Customer Ledger Entry table is named Customer Ledger Entries. FIGURE 3.29 THE CUSTOMER LEDGER ENTRIES FORM3-30 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Header/Line Forms (Document Forms) Many forms within Microsoft Dynamics NAV have characteristics of both a Card form and a Tabular form, for example the Sales Invoice form. The fields that are common to the whole invoice are located on a card-like form with tabs that show one invoice at a time. However, the invoice lines are displayed in a table-like section of the form, where multiple invoice lines, from the same invoice, can be viewed at the same time and edited. These are known as Header/Line forms. Header/Line forms are, in fact, two separate forms associated with two tables. The main form is a card-like form associated with a table. The main form has a subform that displays a worksheet-like form that is associated with a different table, a table which is subsidiary to the first. The subform handles the linkage between the two forms. Naming Header/Line Forms In many cases, a Header/Line form represents a document. In the previous example, the Sales Invoice form, the name of the form is the name of the document that it represents. In other cases, the name of the form is whatever the name of the main form may be without the subform. FIGURE 3.30 THE SALES INVOICE FORM Setup Forms A Setup form is a one-record form that enables users to view and edit the one and only one record in a setup table. The user is not able to insert or delete the single record by using this form. Because there are many fields, these forms contain tabs, just as index tabs, across the top edge to organize the information. Microsoft Official Training Materials for Microsoft Dynamics ® 3-31Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Because there is only one record, the primary key is not displayed anywhere on this form. Naming Setup Forms Setup forms are named with the name of the associated table. For example, the setup form associated with the General Ledger Setup table is named General Ledger Setup. FIGURE 3.31 THE GENERAL LEDGER SETUP FORM Menu Forms A Menu form is an unbound form that enables users to access many of the other forms that are related to a functional area. The Menu form generally consists of command buttons or menu buttons. Menu form is no longer part of standard Microsoft Dynamics NAV, although it can still be developed in C/SIDE. Naming Menu Forms Menu forms are named with the associated functional area, followed by the word Menu. For example, the Menu form associated with the General Ledger functional area is named General Ledger Menu. Other Multi-record Forms There are other forms that enable users to view and edit multiple records at the same time. These include Trendscape forms and Matrix forms. These forms provide great functionality within Microsoft Dynamics NAV, but do not affect the main architecture of the system.3-32 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms An example of a Trendscape form is the Contract Trendscape window. FIGURE 3.32 THE CONTRACT TRENDSCAPE FORM An example of a Matrix form is the Budget window. FIGURE 3.33 THE BUDGET FORM Microsoft Official Training Materials for Microsoft Dynamics ® 3-33Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009Demonstration: Create a Card Form The following demonstration shows how to create a card form by using the Card- Type Form Wizard and add several fields to the card form by using the Field Menu and also add several buttons to the form. Use the Card-Type Form Wizard Many of the form-related tasks presented to this point can be done more easily by using the form wizard. The form wizard can create two types of forms: Card and Tabular. 1. In the Object Designers Form list, click the New button. The New Form window opens. 2. Type Customer in the Table field. 3. Select Create a form using a wizard, leave the Card-Type Form selected and then click OK. The Card-Type Form Wizard opens. FIGURE 3.34 THE NEW FORM WINDOW The Card-Type Form Wizard consists of two questions, and each question represents a step in the wizard. When creating the form in the wizard, click the Preview button to preview the form to be created.3-34 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Step 1 - Should the Form contain tabs? 1. Leave Yes selected. By default the first tab is named General. 2. Click the empty line under General and type Others. FIGURE 3.35 CARD-TYPE FORM WIZARD STEP 1 3. Click Next. Step 2 - Which fields from the Customer table do you want on the tabs? 1. Notice that the form has both of the tabs that are created in Step 1 of the Wizard. 2. Click the General tab. 3. Double-click the following fields: No., Name, Address, and City. These fields are moved to the General tab; alternatively, use the left arrow button to move the fields from the Available Fields list to the Field Order list. 4. Click the Others tab. Notice the Field Order list is empty. Microsoft Official Training Materials for Microsoft Dynamics ® 3-35Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 5. Double-click the following fields: Global Dimension 1 Code, Territory Code, and Global Dimension 2 Code. FIGURE 3.36 CARD-TYPE FORM WIZARD STEP 2 6. Click Finish to end the wizard and open the newly created form in the Form Designer. The form is not yet saved. 7. Compile and save the form with the ID 90002, and the name My Customer Card, and close the form. 8. Run the form, and test the tabs and fields. FIGURE 3.37 MY CUSTOMER CARD FORM Use the Field Menu 1. Design form 90002, My Customer Card, from the Object Designer. 2. Click View, Field Menu or click the Field Menu button on the Toolbar. The Field Menu window opens. 3. Select the Balance field.3-36 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms NOTE: Hold the CTRL key while selecting the fields in the Field Menu window to select multiple fields. 4. Move the cursor over the form, to where the field is to be added, and then click to create a new text box for the field. NOTE: The SourceExpr property of the text box is automatically set to the field selected in the Field Menu and a label is created attached to the text box. FIGURE 3.38 BALANCE FIELD ADDED BY USING THE FIELD MENU 5. Compile, save and close the form. 6. Run the form, and test the field. Add a Command Button The following steps show how to add a command button that closes the form. 1. Design form 90002, My Customer Card, from the Object Designer. 2. Open the Toolbox, and then click the Command Button button. 3. Move the cursor over the form, to the lower right of the form, to the left of the Help button, and then click to create the command button. NOTE: On standard forms, buttons are positioned in the lower right corner of the forms. Microsoft Official Training Materials for Microsoft Dynamics ® 3-37Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 4. Set the following properties for the command button: o PushAction: OK o HorzGlue: Right o VertGlue: Bottom NOTE: The default PushAction <0> causes the button to do nothing except raise its OnPush trigger when it is clicked. Setting the PushAction property to OK sets the button as an OK button. OK buttons close the form when they are clicked. Setting the HorzGlue and VertGlue properties to right and bottom respectively ensures the command button is always proportionally aligned to the lower right corner of the form. 5. Compile, save and close the form. 6. Run the form, and test the command button. FIGURE 3.39 MY CUSTOMER CARD FORM WITH A COMMAND BUTTON3-38 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: FormsDemonstration: Create a List Form The following demonstration shows how to create a list form using the Tabular- Type Form Wizard and add several fields by using the Field Menu, and then make a column invisible. Use the Tabular-Type Form Wizard A list form displays many records at a time to the user. It usually has a table box. 1. In the Object Designers Form list, click the New button. The New Form window opens. 2. Type Customer in the Table field. 3. Select Create a form using a wizard, select the Tabular-Type Form and then click OK. The Tabular-Type Form Wizard opens. The Tabular-Type Form Wizard consists of only one question. Therefore there is only one step in the wizard. When creating the form in the wizard, click the Preview button to preview the form to be created. Step 1 - Which fields from the Customer table do you want on your form? 1. Double-click the following fields: No., Name, Address and City. 2. Click Finish to end the wizard and open the newly created form in the Form Designer. The form is not yet saved. 3. Change the Editable property of the form to No. 4. Compile and save the form with the ID 90003 and the name My Customer List, and close the form. Microsoft Official Training Materials for Microsoft Dynamics ® 3-39 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 5. Run the form, and test the fields. FIGURE 3.40 MY CUSTOMER LIST FORM Use the Field Menu 1. Design form 90003, My Customer List, from the Object Designer. 2. Click View, Field Menu or click the Field Menu button on the Toolbar. The Field Menu window opens. 3. Select the Balance field. 4. Move the cursor over the form, inside the table box, where the column is to be added, and then click to create a new column for the field. NOTE: The SourceExpr property of the text box is automatically set to the field selected in the Field Menu and a label is created as the column header. FIGURE 3.41 BALANCE FIELD ADDED BY USING THE FIELD MENU 5. Compile, save and close the form. 6. Run the form.3-40 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Make Columns Invisible Most users may not have to view the customers balance. By default the column must be made invisible on the My Customer List form. However, every user must be able to make it visible, upon request. 1. Design form 90003, My Customer List, from the Object Designer. 2. Change the Visible property of the Balance column to No. 3. Compile, save and close the form. 4. Run the form. The Balance column is now hidden. Every user can make this column visible by clicking View, Show Column and selecting the Balance field.Demonstration: Link the Card Form and the List Form The following demonstration shows how to create a link from a list form to a card form by using the menu button, menu item and setting several properties. Then, create a link from the card form to the list form by using the Lookup form of the source table. Create a Menu Button The following steps show how to create a link to the card form, from a list form. 1. Design form 90003, My Customer List, from the Object Designer. 2. Move the OK and Cancel buttons to the left, to make room for a new button. 3. On the Toolbox, click the Menu Button button. 4. Add a menu button to the form, between the Cancel and Help button. FIGURE 3.42 MY CUSTOMER LIST FORM WITH A MENU BUTTON Microsoft Official Training Materials for Microsoft Dynamics ® 3-41 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 5. Set the following properties for the menu button: o Caption: Customer o HorzGlue: Right o VertGlue: Bottom NOTE: Most card and list forms contain a menu button with the name of the table. Create a Menu Item The menu button has no menu item yet. The following steps show how to add menu items to the menu button. 1. Right-click the Customer menu button, and then click Menu Items. 2. Click the first empty line, and type the following: Caption ShortCutKey Action RunObject Card Shift+F5 RunObject Form My Customer Card 3. Open the Properties window for the menu item, and set the following properties: o RunFormLink: No.=FIELD(No.) o RunFormLinkType: OnUpdate FIGURE 3.43 MENU DESIGNER AND MENU ITEM PROPERTIES NOTE: The RunFormLink property on the menu item links the My Customer Card form and the My Customer List form. Changing the RunFormLinkType property to OnUpdate keeps the two forms synchronized whenever the calling form is updated. 4. Close the Properties window and close the Menu Designer. 5. Compile, save, and close the form. 6. Run the form, and test the menu button, the menu item and the shortcut key.3-42 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms When the menu item is clicked, the My Customer Card opens and shows the current customer in the My Customer List. If another customer is selected in the My Customer List, the My Customer Card also reflects that customer. This is achieved by setting the RunFormLink and RunFormLinkType property of the menu item. Create a Button to Look Up Information in a Table The following steps show how to create a button to look up information in a table. 1. Design form 90002, My Customer Card, from the Object Designer. 2. Move the OK button to the left, to make room for a new button. 3. On the Toolbox, click the Menu Button button. 4. Add a menu button to the form, between the OK and Help button. 5. Set the following properties for the menu button: o Caption: Customer o HorzGlue: Right o VertGlue: Bottom 6. Right-click the Customer menu button, and then click Menu Items. 7. Click the first empty line, and type the following: Caption ShortCutKey Action List F5 LookupTable NOTE: The PushAction LookupTable brings up the default Lookup form of the forms source table. FIGURE 3.44 MENU DESIGNER 8. Close the Menu Designer. 9. Compile, save and close the form. Microsoft Official Training Materials for Microsoft Dynamics ® 3-43Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 Change the Default Lookup Form The current Lookup form of the Customer table is form 22, Customer List. The following steps show how to change the default Lookup form of the Customer table. 1. Design table 18, Customer, from the Object Designer 2. Set the LookupFormID property of the table to My Customer List. FIGURE 3.45 CUSTOMER TABLE PROPERTIES 3. Compile, save and close the table. 4. Run form 90002, My Customer Card, and test the menu button, the menu item and the shortcut key.3-44 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: FormsDemonstration: Form and Subform Forms can also display information from a table other than that forms source table. One way to do this is to display another form within the first form. This is known as a subform. The following demonstration shows how to build two forms that are combined to show the customer records and the customer comments on one form. Create the Main Form 1. Design form 90002, My Customer Card, from the Object Designer. 2. Adjust the form and the tab control vertically to make room for the subform. This also involves moving the buttons to the bottom of the form. 3. Open the Toolbox, and then click the Subform button. 4. Add a subform to the General tab. Adjust the subform proportioned to the height and width of the tab control. 5. Open the Properties window for the subform and note the value of the Height and Width properties. Height ____________________ Width _____________________ FIGURE 3.46 MY CUSTOMER CARD FORM WITH A SUBFORM Microsoft Official Training Materials for Microsoft Dynamics ® 3-45 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 6. Set the following properties for the subform: o HorzGlue: Both o VertGlue: Both 7. Close the Properties window. 8. Compile, save and close the form. Create the Subform Next is to create the form that displays the comment lines for the customer. It is a worksheet form that fits into the subform on the My Customer Card form. 1. In the Object Designers Form list, click the New button. The New Form window opens. 2. Create a tabular form by using the wizard that contains the Date and Comment fields from the Comment Line table. 3. Delete the OK, Cancel, and Help buttons. 4. Set the following properties for the table box: o Height: Height of the subform created earlier. o Width: Width of the subform created earlier. 5. Move the table box into the upper-left corner of the form and make the form size the same as the table box. 6. Set the following properties of the form: o BorderStyle: None o AutoSplitKey: Yes NOTE: Setting BorderStyle property to None shows the subform without a border. The AutoSplitKey is a characteristic of a Worksheet form that enables entering information to the associated table in a spreadsheet like manner. 7. Compile and save the form with the ID 90004 and the name My Customer Subform, and close the form. FIGURE 3.47 MY CUSTOMER SUBFORM FORM3-46 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Add the Subform to the Main Form The following steps show how to add the subform to the main form by setting up the subform in the main form. 1. Design form 90002, My Customer Card, from the Object Designer. 2. Open the Properties window for the subform, and set the following properties: o SubFormID: My Customer Subform o SubFormLink: Table Name=CONST(Customer),No.=FIELD(No.) NOTE: Use the Assist-Edit button on the SubFormLink property to assist setting this property. The SubFormID property tells the main form what form to be shown in the subform. The SubFormLink property links the main form and the subform by using certain fields. 3. Close the Properties window. 4. Compile, save and close the form. 5. Run the form, and test the subform. FIGURE 3.48 MAIN FORM AND SUBFORM WITH SOME RECORDS IN THE SUBFORM Microsoft Official Training Materials for Microsoft Dynamics ® 3-47Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009Lab 3.1 - Create a Card and a List Form The following lab tests the basic knowledge on how to create a card form, and a list form and how to link both forms together. Scenario Simon is a developer working for CRONUS International Ltd. CRONUS International has decided to start selling Microsoft Dynamics NAV training courses as its business. Simon has already created a Course table to record the courses information. Now, Simon must create forms to interface the Course table so that his users can insert, edit and delete course records as needed, by using Microsoft Dynamics NAV Classic client. Challenge Yourself! 1. Create a Card form for the Course table. 2. Create a List form for the Course table. 3. Create a link from the List form to the Card form. 4. Create a link from the Card form to the List form. Need a Little Help? Create the Card form for the Course table. 1. Create a new Card form with the source table Course. 2. Include the following fields: Code, Name, Description, Duration, Price, Type and Active. 3. Compile, save and close the form. Create the List form for the Course table. 1. Create a new List form with the source table Course. 2. Include the following fields: Code, Name, Description, Duration, Price, Type and Active. 3. Change the Editable property of the form to No. 4. Compile, save and close the form. Create a link from the List form to the Card form. 1. Design the List form. 2. Add a menu button to the form, and set its properties. 3. Add a menu item on the menu button, and set its properties. 4. Compile, save, and close the form.3-48 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: Forms Create a link from the Card form to the List form. 1. Design the Card form. 2. Add a menu button to the form, and set its properties. 3. Add a menu item on the menu button, and set its properties. 4. Compile, save and close the form. 5. Design the Course table, and set its properties. 6. Compile, save and close the table. Step by Step Create the Card form for the Course table. 1. In the Object Designers Form list, click the New button. 2. Type Course in the Table field. 3. Select Create a form using a wizard, leave the Card-Type Form selected and then click OK. The Card-Type Form Wizard opens. 4. Leave Yes selected. 5. Click Next. 6. Double-click the following fields: Code, Name, Description, Duration, Price, Type and Active. 7. Click Finish to end the wizard. 8. Compile and save the form with the ID 90010, and the name Course Card, and close the form. Create the List form for the Course table. 1. In the Object Designers Form list, click the New button. 2. Type Course in the Table field. 3. Select Create a form using a wizard, select the Tabular-Type Form and then click OK. The Tabular-Type Form Wizard opens. 4. Double-click the following fields: Code, Name, Description, Duration, Price, Type and Active. 5. Click Finish to end the wizard. 6. Change the Editable property of the form to No. 7. Compile and save the form with the ID 90011 and the name Course List, and close the form. Create a link from the List form to the Card form. 1. Design form 90011, Course List, from the Object Designer. 2. Move the OK and Cancel buttons to the left, to make room for a new button. 3. On the Toolbox, click the Menu Button button. 4. Add a menu button between the Cancel and Help buttons. Microsoft Official Training Materials for Microsoft Dynamics ® 3-49Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 5. Set the following properties for the menu button: o Caption: Course o HorzGlue: Right o VertGlue: Bottom 6. Right-click the Course menu button, and then click Menu Items. 7. Click the first empty line, and type the following: Caption ShortCutKey Action RunObject Card Shift+F5 RunObject Form Course Card 8. Open the Properties window for the menu item, and set the following properties: o RunFormLink: Code=FIELD(Code) o RunFormLinkType: OnUpdate 9. Close the Properties window and close the Menu Designer. 10. Compile, save, and close the form. Create a link from the Card form to the List form. 1. Design form 90010, Course Card, from the Object Designer. 2. On the Toolbox, click the Menu Button button. 3. Add a menu button to the left of the Help button. 4. Set the following properties for the menu button: o Caption: Course o HorzGlue: Right o VertGlue: Bottom 5. Right-click the Course menu button, and then click Menu Items. 6. Click the first empty line, and type the following: Caption ShortCutKey Action List F5 LookupTable 7. Close the Menu Designer. 8. Compile, save and close the form. 9. Design table 90010, Course, from the Object Designer 10. Set the LookupFormID property of the table to Course List. 11. Compile, save and close the table.3-50 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: FormsStandard Navigation The standard navigation between forms helps establish consistency throughout the application. Although it is optional, it is recommended that all customizations follow these standard navigations. Card and List Forms Most master tables have both a Card and a List form. Because both forms access the same table, there are many standards about what each form must do: • The user must be able to view and edit one record at a time on the Card form. • The user must be able to view, but not edit, all records on the List form. Making this a form that cannot be edited enables the user to start a search by typing in a particular column. • The user must be able to open the List form from the Card form in the following ways: o Press F5. o Click the List menu item on the menu button that has the same name as the table. o Click the List button on the Toolbar. In this case, the user can select a new master record and then click OK to exit the List form and change the original Card form to the selected master record. • The user must be able to open a new card from the List form that displays the master record selected on the List form. Users can open this new card by pressing SHIFT + F5 or clicking the Card menu item on the menu button that has the same name as the table. Master Statistics Forms Many master tables also have a Statistics form. The user must be able to open this form from either the Card or the List forms in the same way. The standard way of opening the Statistics form is with the shortcut key F9 or the Statistics menu item, on the menu button that has the same name as the table. Master and Ledger Forms Every master table has at least one ledger table. The user must be able to open the Ledger form from the master records Card, List and Statistics form. There are three ways to open the Ledger Form: • Click the Drill-down button on a FlowField. Microsoft Official Training Materials for Microsoft Dynamics ® 3-51 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009 • Press CTRL + F5. • Click the Ledger Entries menu item on the menu button that has the same name as the table. If a Drill-down button is clicked, only the records that are used to create the calculated value are displayed. This is the built-in drill-down functionality. If the shortcut key or the menu item is used, all ledger records for this particular master record are shown. This requires a RunFormLink property on the menu item that links the two tables. And to keep the two forms synchronized when the master form is updated, the RunFormLinkType property must be change to OnUpdate. NOTE: For performance reasons, always set the RunFormView property if the RunFormLink property is set. In fact, the sort selected in the RunFormView property must contain the fields listed in the RunFormLink property or performance will be decreased. Journal Forms Every journal form has similar buttons at the bottom of the form. These buttons enable the user to either open another form or perform a task. Generally, the buttons on a journal form are as follows: • A menu button named after the master table for the functional area. This menu button must contain menu items that enable the user to open the card form for the master table or open the Ledger form for the ledger entries. In both cases, the form opened must be linked to the master table record that the journal line is associated with. • A menu button named Posting. This menu button contains the following menu items related to posting the journal lines: o Post o Post and Print o Test Report3-52 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: FormsSummary Forms allow users to interact directly with Microsoft Dynamics NAV. They are effective means for users to view, organize, and add information to the Microsoft Dynamics NAV database. There are many standard forms available in Microsoft Dynamics NAV and C/SIDE provides a means for developers to customize the application to suit their users requirements, by creating custom forms or by modifying existing forms. Developers are encouraged to work in Microsoft Dynamics NAV, become familiar with the various form types found in the application, and practice creating sample forms. This helps developers understand the users needs, and become adept at providing forms that both meet those needs and integrate smoothly into the application. Microsoft Official Training Materials for Microsoft Dynamics ® 3-53 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 2009Test Your Knowledge 1. True or False. All forms are bound. 2. True or False. The Form Wizard is not useful. 3. Which property must be set on the Command button for the RunObject property to work? 4. Which control enables a form to display more than one record at a time? 5. Which control enables one form to display another form? 6. Which property of a Text box binds it to a field in a table? 7. What form property binds a form to a table? 8. How is a menu item turned into a submenu on a menu button? 9. How is a label attached to another control so that the label follows the other control if it is moved? 10. What are the steps to create a List form for a table?3-54 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement
    • Chapter 3: FormsQuick 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 ® 3-55 Your use of this content is subject to your current services agreement
    • C/SIDE Introduction in Microsoft Dynamics® NAV 20093-56 Microsoft Official Training Materials for Microsoft Dynamics ® Your use of this content is subject to your current services agreement