Creating and Setting Up Tables - Overview

The Data Builder can store a great deal of information about a table and its fields. You may decide not to set up all the information the Data Builder stores for every table and every field. Certainly, you don’t have to set up all field properties before you start using a table to build Application Objects. Most field properties can be entered and changed later.

However, there are certain table and field properties that you should set up as a minimum before you start building Application Objects. If you don’t set up those table and field properties, VPM Enterprise won’t be able to trigger all its automatic features that help you build Application Objects. 

You can, of course, set up all table and field properties before you start creating Application Objects. In fact, you are encouraged to do so. It’s probably more productive and efficient to use the Data Builder to set up all table and field properties at one time than to do it piecemeal.

The minimum steps required to create and set up a table in the VPM Enterprise Data Builder are described below. These steps point out the table and field properties that you should set up before you build an Application Object that uses the table.

Ø To set up a table in the Data Builder

1.   Select Database - Tables or Free Tables: On the List page in the Data Builder select the Tables node under the database that you want to contain the table. Select the Free Tables node if you want the table to be a free table.

2.   New or Add: Click the New button to create a new table or click the Add button to find an existing table. VPM Enterprise displays appropriate dialogs to either create or add a table. See Creating Tables and Adding Tables for the details on how to create and add tables using the Data Builder.

3.   Creating New Tables: If you’re creating a new table, VPME will display the VFP Table Designer. Enter the table's fields, field types and field dimensions.

4.   Adding Existing Tables: If you’re adding existing tables, you can add more than one table at a time. You can even add all the tables in a directory at once.

Add Tip: Be sure that the tables you add conform to the same requirements described in this chapter for the new tables you create.

5.   Required Indexes: For the table you’ve created or added, use the VFP Table Designer to create and modify the table’s indexes. Select the table and click the Designer button on the List page to access the Table Designer.

    Tip: You must create the indexes described in Required Indexes for Tables.

    When you have created the table indexes you need, click OK to close the Table Designer and return to the Data Builder.

6.   Table Properties: With the table selected in the treeview, click the Edit page.

·       Description: Enter a Description for the table.

   See Setting Table Properties for the details on using the Data Builder to set up table properties.

7.   Primary Key: Identify the table’s primary key index tag. Expand the table’s item list in the treeview and select the primary key index tag. Click the Edit page. Check the VPM Primary checkbox on the Edit page to designate the tag as the primary key index tag.

Primary Key: The primary key is the field or combination of fields that uniquely identifies each record in a table. It is important that you identify each table’s primary key because VPM Enterprise uses the primary key to automatically set up certain data integrity rules. VPM Enterprise automatically prevents the entry of duplicate primary keys into tables and local views on forms based on the VPM Enterprise Form_Toolbar form class. The VPM Enterprise form classes are discussed in later chapters.

Automatic Key Generation: If you want VPME to automatically generate primary keys for the table, see Generating Surrogate Primary Keys.

8.   Referential Integrity: If the table contains a foreign key field matching the primary key of another table, view or CursorAdapter, select the field in the treeview list and click the Edit page. Click the Integrity page and set up Referential Integrity validation for the field(s) in the foreign key. VPM Enterprise uses your Referential Integrity validation setup to determine how tables, views and CursorAdapters are related to each other in an application.  See Referential Integrity for the details.

Parent-Child Relations: You may be more familiar with Parent-Child terminology than the term "referential integrity".  A table with a foreign key matching the primary key of another table is called a “child table” by some developers. The table with the matching primary key is called a “parent” table.  In these terms, when you use the Data Builder’s Integrity field property to set up Referential Integrity validation, you are actually defining a relationship between a child and parent table.

9.   Field Label & Grid Captions: For each table field that will appear on a form or report, select the Edit - Properties page and enter descriptive labels in the Description (Short) and Description (Long) text boxes. Enter the label you want in a grid header in the Description (Short) text box. Enter the descriptive label that you want to appear next to the field on a form in the Description (Long) text box.

The remainder of this chapter describes in detail how to create and set up your application’s tables in the VPM Enterprise Data Builder. 


Creating Tables