Progress
Basic Database
Tools


Schema>Field Editor

Choose Schema Field Editor to modify schema definitions for a field. When you choose this option, Progress alphabetically lists all the tables defined for your database. Select the table you want to edit. Progress lists all the fields defined for the selected table. Figure 9–7 shows the fields defined for the customer table.

Figure 9–7: Field Editor Window

From this window you can add, edit, delete, or view field attributes defined for the current table. Table 9–5 describes the options for the Field Editor.

Table 9–5: Field Editor Options
Option
Description
NextPage
Displays the next page of fields.
PrevPage
Displays the previous page of fields.
Add
Adds a new field.
Modify
Updates field attributes.
Delete
Deletes a field.
Copy
Copies fields from table definitions.
Triggers
Defines or modifies triggers.
View-As
Defines the 4GL View-As phrase for field widget type.
StringAttrs
Defines or modifies string attributes.
GoIndex
Goes to the Index Editor.
SwitchTable
Switches to a different table.
Browse
Displays the field attributes.
Order
Toggles between displaying fields in alphabetical order or in the order defined by the values in their _Order fields. Progress displays a message at the bottom of the window indicating how the fields are currently ordered.
Undo
Undoes any changes you made to the field attributes for this Field Editor session.
Exit
Saves your changes, exits the Field Editor, and returns to the Data Dictionary Main Menu.

Choose an option, then select the field you want to edit. The following sections describe the Add, Triggers, View-As, and GoIndex options in more detail.

Add Option

Choose the Add option from the Field Editor dialog box to create a new field in the selected table. When you choose this option, a window similar to the one shown in Figure 9–8 appears.

Figure 9–8: Field Add Option Window

NOTE: In previous versions of Progress, adding a field to an existing database table was a time-consuming process for large databases. The DBMS had to update the data in each row of the table to reflect the newly added field. Progress now provides a fast schema change when you are adding fields to a table. Fast schema change is the default behavior.

The Field Add window contains the following user-interface elements:

Table 9–7 shows examples of the different formats of a character field.

Table 9–7: Character Display Format Examples 
Format
Value in Field
Display
xxxxxxxx
These are characters
These ar
x(9)
These are characters
These are
x(20)
These are characters
These are characters
xxx
These are characters
The
AAA–9999
abc1234
abc–1234
(999) 999–9999
6172754500
(617) 275-4500
!!
ma
MA

Progress truncates trailing spaces in character fields. If a character field contains only one space, Progress truncates the space to a null value. You can use the TRIM function to truncate leading and trailing spaces.

Label

Specifies the label that represents the field in windows or in printed reports. The default value is a question mark (?). If you leave the question mark and do not supply a label, Progress uses the field names as the label. If you replace the question mark with a space, Progress uses no label for the field. Labels can be up to 30 characters long. Table 9–12 shows some field label examples.

Table 9–12: Field Label Examples 
Format
Label You Define
Label Progress Displays
Name
?
Name
Curr-bal
Unpaid Bal
Unpaid Bal
Sales-rep
space
 

You can override the labels you define in the Data Dictionary by using LABEL, NO-LABEL, or COLUMN-LABEL options in a Format phrase, or NO-LABEL in a Frame phrase. Progress uses COLUMN-LABEL only for fields that do not have SIDE-LABEL. See the Progress Programming Handbook for more information about these phrases.

Column-Label

Specifies that you want to use a different label when the data are listed in columns. If you do not specify a column label, Progress uses the label specified in the Label field. If you do not enter a label, Progress uses the field name. You can override these labels by using NO-LABEL or COLUMN-LABEL options in a Format phrase, or NO-LABEL in a Frame phrase.

If you want the column label to have more than one line (stacked), separate each line of the label with an exclamation point (!). For example, if you want the label for the Curr-bal field to be Unpaid Balance, with the word “Unpaid” displayed above the word “Balance,” enter Unpaid!Balance for the column label. If you want to use the exclamation point as one of the characters in a column label, you must use two exclamation points (!!). Any spaces to the right or left of the exclamation point become part of the label.

Initial

Defines the initial value for the field. Each data type has an initial value. When you create a new record for a table, each field contains this initial value. You can change a field’s default initial value when you define the field. Table 9–13 lists the default initial values for each data type.

Table 9–13: Field Initial Values 
Data Type
Initial Value
Character
Null string (displays spaces)
Integer
0
Decimal
0
Logical
no (false)
Date
? (unknown value; displays spaces)
Raw
Null string (displays spaces)
RECID
? (unknown value; displays spaces)

You can use a question mark (?) as a special character to represent an unknown value. This lets you handle data even when some critical item of information is not yet known. If you put a single question mark in any field, Progress treats the item of data as an unknown value.

You can also use TODAY as the initial value for a date field. When you create a new record, Progress fills in the current date as the initial value for the field.

Component of View

Displays information only; it is not updatable. It tells you whether the field is used in an SQL view. When you use a field as a component of an SQL view, you cannot delete it.

Component of Index

Displays information only; it is not updatable. It tells you whether the field is a component of an index.

Data-Type

Determines the kind of data values the field can store. Table 9–14 describes the available data types.

Table 9–14: Data Types
Data Type
Description
Character
Contains data of any kind. Character data can include uppercase and lowercase characters and can consist of alphabetic characters, digits, and the characters $, &, #, %, –, and _. Although Progress allows character field display formats of up to 255 characters, restrict the format length of a character field to the input/output line width of your terminal (typically 80 characters) by specifying the appropriate length in the Format field.
Integer
Contains only whole numbers. They can be positive or negative, from –2,147,483,648 through 2,147,483,648, inclusive. If you enter spaces as the value of an integer field, Progress stores the value of that field as 0.
Decimal
Contains decimal numbers up to 50 digits. You can use up to 10 digits to the right of the decimal point. If you enter spaces as the value of a Decimal field, Progress stores the value of that field as 0. When you choose decimal as the data type, Progress enables the Decimal field. You specify the number of decimal places in the Decimal field.
Date
Contains dates from 1/1/32768 B.C. to 12/31/32767 A.D., inclusive. You can specify dates in this century with a two-digit year, such as 8/9/93, or a four-digit year, 8/9/1993. Dates in other centuries require a four-digit year. If you enter dates without the year, Progress assumes the current year. If you supply spaces as the value of a date field, Progress stores that field as an unknown value and displays it as spaces.
Logical
Contains logical values such as yes/no or true/false.
Raw
Contains the value of a field from a non-Progress database that has a data type with no equivalent in Progress. When you want to work with Raw data, you generally work with the data at the byte level. A Raw value cannot be displayed.
Recid
Contains the record ID.

Extent

Defines the extent of an array field. Most fields represent a single value. However, array fields contain multiple elements. For example, the Mnth-shp field of the time table is an array field. It contains 12 elements, one for every month of the year. The extent is the number of elements contained in an array. If you define a field with an extent greater than 0, that field is an array field.

Decimals

Defines the decimal places for a field. When you define a decimal field, you must define the number of digits to the right of the decimal point. For example, Max-credit has been defined for two digits to the right of the decimal point to accommodate dollars and cents. If the field is not a decimal, you cannot enter a value.

Order

Specifies the default display order of a field. By default, the Data Dictionary numbers fields in the order you enter them, by increments of 10. This defines where Progress lists the field in the field selection list in this table. You can set the order for this field in the table. This display order is not related to the order in which the data are stored in your database. In addition, you can override the Dictionary display order of fields in your procedures by naming the fields in the order you want to display them.

The default order numbering is in increments of 10 to let you insert fields in between. The numbers do not have to be contiguous, nor do they have to follow in even-numbered increments. For example, if you decide to add a field called Category to the customer table, and you want it to appear by default on your window between Cust-num and Name, you might assign 15 as its order value. If you want to change the order number increments to 20, you can do so by choosing the Reorder Fields option of the Schema menu. From the same menu option, you can also change the order values to reflect the alphabetical order of the table names.

Mandatory

Specifies if the field is mandatory. If you define a field as mandatory, it cannot contain an unknown value (?). However, it can have a space as its value. The default value is no. If you accept no for this field, you indicate that the unknown value is an allowed value for the field.

Case-sensitive

Specifies if the field is case sensitive. The default value is no. Because case-sensitive fields depart from the Progress standard, they are not recommended. However, if you require strict adherence to the ANSI SQL standard or if you are using a DataServer that supports case sensitive fields, you might have to define all character fields as case sensitive. Once you define a field as case sensitive, you can redefine it, unless it is a component of an index. If a field is a component of an index, you cannot change its case sensitivity unless the index is undone.

You can index case-sensitive fields and group them with case-insensitive field components in an index. With case-sensitive indexes, JOHN, John, and john are all unique values. However, they do not sort next to each other. All uppercase letters sort ahead of all lowercase letters. Define case-sensitive variables to hold values moving to and from case-sensitive fields.

Valexp

Specifies the validation criteria for the field. You can enter up to 63 characters on each of the four lines. For messages that exceed 252 characters, you can specify an include file enclosed in brackets (use the syntax: {filename.i}). There is no default value.

NOTE: You should use field validation for backward compatibility for procedure-driven applications. For event-driven programs, Progress Software Corporation recommends that you use field ASSIGN triggers instead of field validation.

When a user enters a value for a field, you might want to test it to make sure it is a valid entry for the field. The Valexp option lets you define a test or validation expression. The expression must be logical; that is, it must be a valid Progress expression that produces a true or false result.

For example, the validation expression for the Cust-num field in the customer table is cust-num > 0. When the user enters a customer number, Progress validates that number against valexp. If the number is greater than 0, valexp is true, and the validation succeeds. If the number is less than 0, the validation fails. Progress then displays the text in the Valmsg option.

When you write procedures, you can override any validation expressions you define in the Data Dictionary. If you define validation for an array field in the Data Dictionary, the validation only works if you update the entire array. The validation does not work if you update the array elements individually.

Valmsg

Defines the validation message for a field. You can enter up to 63 characters on each line. You cannot define (and do not need) a validation message unless you specify a validation criteria for a field. If the result of Valexp is false (the validation fails), Progress displays the text specified in Valmsg. For example, the validation expression for the Cust-num field in the customer table is cust-num > 0. When the user enters a 0 for the customer number, Progress displays this message:

Customer number must be greater than zero. 

Because Progress treats the message you define as constant (literal) text, it cannot contain references to the number of the fields or variables. If you want to use fields, variables, or expressions in validation messages, use this VALIDATE option in a Frame phrase.

Help

Defines help information for the field. For certain fields, users might be unsure of the kind of data they need to enter. Therefore, you can specify a help message to indicate what information to enter. Progress displays this message whenever users are prompted for input to the field. For example, the State field in the customer table uses this help message:

Enter standard state abbreviation. 

Desc

Describes the field. You might want to document the purpose of a field just as you might supply a description for a table. Progress does not use this option when running procedures; it is strictly to help you document your application.

Field Triggers Option

Choose the Triggers option from the Field Editor to define ASSIGN trigger programs for the field. ASSIGN triggers execute when you assign a value to a database field. When you choose the Triggers option, the Field Triggers dialog box similar to the one shown in Figure 9–9 appears.

Figure 9–9: Field Triggers Dialog Box

This dialog box contains the following user-interface elements:

For ASSIGN

Specifies the name of the trigger procedure. If you want to create or edit the procedure, press PUT and a trigger editor appears.

Overridable?

Specifies whether a session trigger can override the schema trigger. The default value is no. For more information about session and schema triggers, the chapter on database triggers in the Progress Programming Handbook.

Check CRC?

Specifies whether Progress verifies the cyclical redundancy check (CRC) code. The default value is no. When Progress checks the code, it compares the stored CRC value of the procedure to the CRC of the trigger when it fires. If they are different, Progress does not run the procedure. This ensures that no one changes the trigger code without proper permission.

You can also edit the trigger program in the Progress Editor.

View As Option

Choose the View As option from the Field Editor to define the View-As phrase for the type of field widget. When you choose this option, Progress displays the View-As Phrase dialog box as shown in Figure 9–10.

Figure 9–10: View-As Phrase Dialog Box

The list of available widgets depends on the data type of the field. Table 9–15 lists which widgets you can use for each data type. The numeric data type refers to the decimal, integer, and date data types.

Table 9–15: View As Widgets

Widget Type
Data Type
Character
Numeric
Logical
Combo-box
Editor
Fill-in
Radio-set
Selection-list
Text

When you select a widget type, Progress displays the appropriate View-As phrase syntax for the field. Choose the Copy Syntax button to copy the syntax to and overwrite any existing text in the editor area of the dialog box. After you edit the View-As phrase, press GO. Progress compiles the code. If there are errors in your code, Progress displays the code and lists the errors. If the code is syntactically correct, Progress stores the value and returns you to the Field Editor. When you use this field in an application, it appears as the specified widget type. For more information about defining widgets, see the chapter on widgets and handles in the Progress Programming Handbook.

GoIndex Option

Choose the GoIndex option to access the Index Editor. When you choose this option, a window similar to the one shown in Figure 9–11 appears.

Figure 9–11: GoIndex Option Window


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095