Creating a New Table
- Field Names
- Field Types
- Bitmap
- Data Type:
- Character
- Data Type:
- Date
- Data Type:
- Exponent Numeric
- Data Type:
- Image File Reference
- Data Type:
- JPEG Image
- Data Type:
- Logical
- Data Type:
- Memo
- Data Type:
- Numeric
- Data Type:
- OLE
- Data Type:
- Rich Text Memo
- Data Type:
- Short Time
- Data Type:
- Time
- Data Type:
- Field Width
- Decimal
- Indexed?
- Global Calculated Fields
- Session or Global Variables
- Saving a Table
Description
Typically, you create new database tables by defining their data field structure in the Table Editor window. Other methods for creating tables include:
Using the Alpha Anywhere New Table/Set Genie?.
Importing database files from other programs, such as Microsoft Access, Excel, Outlook, and Visual FoxPro.
From the Tables/Sets tab on the Control Panel, click the New button and select New Table (Design mode).
The Table Editor opens, where you define the structure of the new table.
The Table Editor looks like a spreadsheet (and a bit like an Alpha Anywhere table). In the Table Editor, you define the type of information that will be stored in your table, in contrast to entering the information to be stored in the table. Using the Table Editor you describe the Fields that make up the new table. Each row in the Table Editor creates a Field and defines the properties of the Field. For the checkbook register, there are four fields: Transaction Number, Date, Payee, and Amount. Therefore, four rows are filled in the Table Editor, one for each field. Each of these fields will appear as Columns in the resulting table.
Field Names
Start by entering a field Name, which can be up to 32 characters. The field name must start with a letter, and can contain the characters A-Z, 0-9, and the underscore character (_). If you use a space in the field name, Alpha Anywhere inserts an underscore in place of the space.
Field Types
In the Type column you specify the type of information the field will contain. You select the field type from drop-down list of preset values. Alpha Anywhere recognizes the selected field type and understands how to handle information in the field. In the checkbook example, the Date column is designated as a date field, while the Transaction Amount is stored as a numeric field. Some things to keep in mind about field types when creating a table: When you create a numeric field and use decimal places, the width you enter needs to include numbers on both sides of the decimal point and the decimal point itself. For example, if the largest value you want to store is 99.99, enter 5 in the Width column and 2 in the Decimal column. Numeric information that won't be used to perform numerical calculations (e.g. ZIP codes or phone numbers) should be stored in a character field instead of a numeric field. This lets you add zeros and formatting characters. For example, the ZIP code 01803 becomes 1803 when stored in a numeric field and (617) 555-1212 won't be accepted in a numeric field because of the non-numeric characters. Alpha supports the following eleven field types. Note that there are variable data types that are not supported as field types.
Bitmap
Stores bitmap (.bmp) image files as Data in the table.
Character
The most common field type, Character allows any combination of alphanumeric characters. Maximum of 255 characters.
Data Type:
Yes
Date
Contains a date only. Alpha Anywhere automatically sets the width to 8 for all date fields. Valid dates are 01-01-0000 through 12-31-9999.
Data Type:
Yes
Exponent Numeric
A fixed precision decimal number.
Image File Reference
A field that links to and displays an image (.jpg or .bmp) without storing it in the table.
JPEG Image
Stores JPEG (.jpg) image files as data in the table. Refer to Creating a Bitmap Image Field and Creating a JPEG Image Field.
Logical
Contains a single character, signifying TRUE or FALSE. You can display logical fields as Check boxes.
Data Type:
Yes
Memo
Contains a 10-character pointer to a special memo field file, which can contain a virtually unlimited number of characters. Memos are stored internally as either character or binary (blob) data.
Numeric
Contains numbers, including a decimal point, any decimal places, and a negative sign. A number can contain up to 14 decimal places. Maximum of 19 characters.
Data Type:
Yes
OLE
Contains an OLE object, such as a spreadsheet or text file. (OLE is short for object linking and embedding, a method of integrating information that's processed in other applications.)
Rich Text Memo
Similar to a memo field except you can change the font, alignment, color, and size.
Short Time
Contains a time. Sets the width to 9 for all short time fields.
Data Type:
Yes
Time
Contains a date and time. Sets the width to 17 for all time fields.
Data Type:
Yes
Field Width
The number of characters allowed in the field. Adjust the field width to suit your needs. Some field widths are pre-defined, such as Date (8), Memo (10), and Logical (1).
Decimal
The number of decimal places allowed for numeric fields. The Decimal specification is only available for Numeric field types.
Indexed?
Create a simple one-field index (alphabetical or numerical) to speed up querying. Alpha Anywhere automatically creates indexes for fields you specify Ascending or Descending in the Indexed? column. For example, if you are creating a table to store customer information, you might want to create an index for a Customer_ID field, since it is likely you'll want to order and select records based on the Customer_ID. By creating an index, you speed up queries and other operations that use the indexed field.
Global Calculated Fields
Clicking the 'x-y' icon displays the Define Calculated Fields dialog box. This dialog allows you to define calculations (know as Calculated fields) that will be available to all layouts based on this table. Refer to Calculated Fields for more information.
Session or Global Variables
Clicking the 'v' icon displays the Define Variable dialog box. This dialog allows you to define session or global variables. Refer to Define Variable Dialog Box for more information.
Saving a Table
When you finish defining the table structure, click the 'save' button or select File > Save to save the table in the database.
See Also