Creating a table

Tables are the building blocks for all other Dynamics NAV objects. They store the data that the business needs to access. This recipe will show you how to create a basic table and save it in the system.

How to do it...

  1. Create a new table object with Object Designer.
  2. Add the following fields in the table designer window:

    Field No.

    Field Name

    Data Type

    Length

    1

    Entry No.

    Integer

     

    2

    Document No.

    Code

    20

    3

    Description

    Text

    30

    4

    Value

    Decimal

     

    5

    Posting Date

    Date

     

    It should look like the window shown in the following screenshot:

    How to do it...
  3. To save the table, go to File | Save (or press Ctrl + S).

In the Save As window, provide values to the ID and Name fields and keep the Compiled checkbox selected to save the table.

How it works...

Each field is just like a variable. These variables, however, are grouped together to form a new type of variable called a record. The field definitions provide the structure for all of the tables, as well as the data in them, inside the system. The data type of your fields can be almost anything. In this example, we have created five fields of the most common types.

There's more...

After completing the initial draft of your object, it is good practice to add a few notes, such as your initials and a date or a version number in the Description column, whenever you add a new field. This allows future developers to know precisely when the change was made and also what other modifications were made. An example description could be XX 01/01/2013 MOD001.

To maintain consistency and enable multilevel development, Microsoft has restricted designing of table and fields depending on their IDs. Visit the following URL for more detailed information on object numbering conventions:

http://msdn.microsoft.com/en-us/library/ee414238(v=nav.70).aspx

See also

  • Adding a key to a table
  • Adding a FlowField
  • Creating a SumIndexField
  • Using a query to extract data
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.227.231