Lesson 1 - Data Import

Top  Previous  Next

Lesson Tasks:

·

Create a new dictionary. This dictionary will be added to, and used in subsequent lessons.

·

Import table definitions using 3 different techniques.

 

Creating a New Dictionary

1. To create a dictionary, choose File  New File from the IDE Menu.

Then, the New File window appears which contains a Clarion Data Dictionary category to allow you to specify the Data Dictionary to create.

2. To create a database dictionary, choose the Data Dictionary Quick Start.

3. Press Create to complete the New window.

 

As you complete the design of your dictionary, you will be prompted to save to the desired name.

 

As an alternative, you can select the Dictionaries link on the IDE Start Page, and press the New Dictionary button.

 

Adding Tables to Your Dictionary

The first step in Dictionary Design is to define the data tables that you need to manage and process.

 

Design Variations

Some developers prefer to create their dictionary by defining a single table, adding the various fields to the table, and then the keys. After the keys are defined, they would proceed to the next table and repeat the entire process.

A second method described here is probably an easier process.

First define all of your tables, and then proceed to define all of the fields. After all of the fields are defined, proceed to define all of your keys. Finally, the table relationships can be defined, and other auxiliary features can then be added to selected elements before finishing the dictionary design process.

So let’s get started with the creation of our dictionaries’ table definitions. We will show you three very popular techniques used in creating your tables.

 

Technique 1: Import a Table

This technique is popular and sometimes necessary when you would like your dictionary to accurately reflect an existing table structure.

To begin the import process:

1. Select the File  Import Table option from the toolbar menu of the DCT Explorer:

 

 

2. Specify a data table and additional options in the Import Table dialog.

When you import an existing table, the field and key information should also be imported. The amount of information imported is dependent on the table type you have selected.

Technique 2: Copy and Paste from an Existing Dictionary

The second technique that we will demonstrate is a popular short cut with Clarion developers.

Many times, you will find an existing dictionary that contains a table definition that is close to the type of table that you are creating. For example, a customer table with a first name, last name, address, city, state, zip, etc. is very similar to a contacts or prospects table.

The begin the Copy and Paste process:

1. With the Dictionary dialog active, select the File  Open option from the main menu. Choose the dictionary that you wish to copy from.

2. Highlight the table that you wish to copy, and choose the Edit Copy option from the main menu, or press the Copy button located on the toolbar (or right-click on the table aand select Copy from the popup menu).

3. Navigate to your target dictionary, highlight the Tables node on the DCT Explorer, , and select the Paste option, located on the toolbar, main menu, or popup menu.

Unlike the first option, this technique will import additional table information that was stored in the source dictionary. Examples of this are custom field pictures, help ids, default controls, etc.

Clarion is packed with example dictionaries that contain a wide variety of table types. It’s a safe bet to assume that, with a little research, you will discover a dictionary and its tables that comes close to the type of database you actually need. See the on-line Guide to Examples for specific information about the Clarion default examples that are installed.

 

Technique 3: The Custom Method

When there is no existing data table structure to emulate your planned database design (either on disk or in another dictionary), you may have to design a table definition from the ground up.

To add a table to your dictionary using the "custom" method:

1. With the DCT Explorer dialog active, press the Add Table button.

The Add Table dialog is displayed.

2. In the Label field, type the label (name) to be used when referring to this file from within the application. Labels may be up to 255 characters, however, limit your name to a reasonable length. Labels consists of alphabetic characters, numbers, the underscore character ( _ ), and the colon ( : ). Labels may not begin with a number or a colon and are not case sensitive. The underscore character is often used as a separator for readability (i.e. INVOICE_FILE) since a space is not valid in a label. Mixed case is often used for greater readability (i.e. InvoiceFile).

 

Next: Lesson 2 - Table Properties