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.
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:
- Field-Name
Specifies the field name. Names can be up to 32 characters long and can consist of alphabetic characters, digits, and the characters $, &, #, %, -, and _. Field names must begin with A–Z or a–z. You cannot use Progress keywords as field names. Field names are not case sensitive.
If you select a table name, Progress displays all the field data from the existing field.
- Format
Specifies the length of a field and the way the data is shown on the screen and in printed reports. Progress automatically supplies a default format for each data type, but you can change it. You can also override formats you define in the Data Dictionary by using the FORMAT option with the Format phrase. For more information about formatting in procedures, see the Progress Programming Handbook.
You can also add storage information for some non-Progress databases. See the appropriate Progress DataServer Guide for more information.
The following list describes the default format for each of the data types:
- Character — The default format for a character field is x(8). The x represents an alphanumeric character position and the 8 indicates the number of characters to display. Table 9–6 describes the different symbols you can use to define a character format.
Table 9–7 shows examples of the different formats of a character field.
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.
- Integer and decimal — The default display format for an integer field is –>,>>>,>>9. The default display format for a decimal field is –>>.>>9.99. Table 9–8 describes the format characters for numeric display formats.
When specifying a numeric data format, you must use at least one of the following characters: 9, Z, *, or >.
Table 9–9 shows examples of the different formats for a numeric field.
NOTE: If you use the European Numeric Format (-E) startup parameter, Progress interprets commas as decimal points and decimal points as commas when displaying or prompting for numeric values. However, always enter formats in the Dictionary as described above. For more information about formatting in procedures, see the Progress Programming Handbook.
Table 9–9: Numeric Display Format Examples Format Value in Field Display 9999 123 0123 9,999 1234 1,234 $zzz9 123 $123 $>>>9 123 $123 1 $–>,>>9.99 1234 $1,234.00 $>,>>9.99 1234 $1,234.00 #–zzz9.999 –12.34 #–12.340 Tot=>>9Units 12 Tot=12Units $>,>>9.99 –12.34 ????????? 2 $>,>>9.99 1234567 ????????? 3 >>,>99.99<<< 12,345.6789 12,345.684 >>,>99.99<<< 1,234.5678 1,234.5684 >>,>99.99<<< 123.45 123.454 >>,>9.99<<< 12.45678 12.456784- Date — The default date format is mm/dd/yy. Date formats specify a two-digit month and a two-digit day. You can use a slash (/) or a hyphen (-) as a separator. You can specify a year with two or four digits. When -yy is set at 1950, the default (allows you to set dates for the next century), Progress determines if the two-digit value in the date is greater or less than 50. If the date value is greater than 50, Progress writes the date for the twentieth century. If the date value is less than 50, Progress writes the date for the twenty-first century. For example, if you start Progress with -yy 1950, years 50-99 are treated as 1950-1999, and years 00-49 are treated as 2000-2049. For more information about the Progress date format, see the chapter on startup parameters in the Progress Startup Command and Parameter Reference. Table 9–10 shows some date display format examples.
Table 9–10: Date Display Format Examples Format Value in Field Display 99/99/99 8/10/2001 08/10/01 99/99/9999 08/10/2090 08/10/2090 99-99-99 08/10/1993 08-10-93 99-99-99 08/10/2090 ???????? 1 999999 08/10/1997 031097 999999 08/10/01 081001 99999999 08/10/2001 08102001- Logical — The default logical format is YES/NO. You can define any strings to represent those TRUE/FALSE values. If you define your own logical values, the false value cannot begin with “y” or “t”, and a true value cannot begin with “n” or “f”. If input is coming from a file and you have defined a format for a logical field that is something other than TRUE/FALSE or YES/NO, you can still use TRUE/FALSE or YES/NO as input to that logical field.
Table 9–11 shows logical display format examples.
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.
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.
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:
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:
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 |