Changing Field Definitions

This section provides an overview of the effects of changing field definitions and discusses how to:

  • Change field types.

  • Rename field definitions.

  • Delete field definitions.

  • Print field definitions.

When you develop new record definitions or modify existing ones, you might need to change characteristics or attributes for a field. If you change attributes in a field definition, the change affects every occurrence of the field in every record definition. So, before you change basic attributes in a field definition, consider how it affects all of the record definitions in which the field occurs. If the change is not appropriate for every occurrence of the field, consider defining a new field instead.

If a change is still needed, you should determine the extent of the change by finding out how many records are affected. Do this by using the Find Definition References tool. Open the field definition and select Edit > Find Definition References or right-click and select the option from the pop-up menu. If you are in a record definition window, another method is to select the field, right-click the field name, and select Find Definition References­-Field from the pop-up menu.

The Find Definition References tab in the Output window displays a list of all projects, record definitions, page definitions, messages, channels, file layouts, and PeopleCode programs in which the field is used. Double-click a line of output to open the corresponding definition in the definition workspace.

Note: Changing the name or length of a field definition requires that you modify the underlying SQL table. Do this either by running the build process and specifying Create Tables or Alter Tables, or by carrying out an action issued by your system administrator. For example, if you change the length of a field definition and 30 record definitions contain the same field name, then you must create or alter 30 records.

Change a field type by opening a field and selecting another field type from the drop-down list box. However, this feature is intended as a design-time change—that is, before your tables are created in the database. While you can convert some field types, the results vary depending on your database platform.

Note: If you change a field from one type to another, you must rebuild all records containing that field by running the Alter process. Use Find Definition References to find all instances of the changed field.

See Altering Tables.

You can use either the Rename Definition dialog box or the Open Definition dialog box to rename a field definition.

Using the Rename Definition Dialog Box

To rename a field definition from the Rename Definition dialog box:

  1. Select File > Rename to open the Rename Definition dialog box.

  2. Select Field as the definition type.

  3. Enter the name of the field.

    If you are not sure of the name or the correct spelling, use the search criteria fields to locate the field to rename. The list displays field names that match your search criteria.

  4. To rename a field in the list, select the field and click Rename or double-click the field.

    The field name becomes available for entry, and you can enter a new name.

  5. When you finish typing the new name, press enter or click the Rename button.

    The Rename Field dialog box appears. Select the records in which you want the field to be renamed. The De-select All button toggles to Select All.

  6. Click OK.

Using the Open Definition Dialog Box

To rename a field definition from the Open Definition dialog box:

  1. Select File > Open to access the Open Definition dialog box.

    This dialog box enables you to set up search criteria for locating field names.

  2. Select Field as the definition type.

    If you have additional information, use the Name field. You can further narrow your search criteria by selecting a field type or the name of the project that contains the field to delete.

  3. Click the Open button or press enter when you have completed your search criteria.

  4. You can rename a field in the Open Definition dialog box by selecting the field, right-clicking the field name, and selecting Rename.

    You can also select the field name and click it a second time. The field name becomes available for entry and you can enter a new name.

  5. When you finish typing the new name, press enter or click the Rename button.

Results of Renaming Field Definitions

When you rename a field, the system automatically changes all occurrences of it, including data in tables with columns named FIELDNAME where the data matches the field being renamed.

The only references that are not renamed are the text portions of SQL functions, such as SQLExec and Scroll Select. If you already used SQL Create to create the underlying tables for the record definitions that contain the field that you renamed, you must recreate or alter those tables. If the tables contain data that you want to preserve, use the SQL Alter function to rename the database table fields.

You can use either the Delete Definition dialog box or the Open Definition dialog box to delete a field definition.

Using the Delete Definition Dialog Box

To delete field definitions by using the Delete Definition dialog box:

  1. Select File > Delete to open the Delete Definition dialog box.

    Set up search criteria for locating field names.

  2. Select Field as the definition type.

  3. If you have additional information, use the Name field.

  4. Select a field type or the name of the project that contains the field that you want to delete.

    This selection further narrows your search criteria.

  5. When your search results appear in the output window, delete the field definition by selecting the field and clicking the Delete button or double-clicking the field name.

Note: You cannot delete a field that is currently used in any records. Before you delete a field definition, you must first remove it from records in which it appears.

Using the Open Definition Dialog Box

To delete field definitions by using the Open Definition dialog box:

  1. Select File > Open to access the Open Definition dialog box.

    This dialog box enables you to set up search criteria for locating field names.

  2. Select Field as the definition type.

  3. If you have additional information, enter it in the Name field.

  4. You can further narrow your search criteria by selecting a field type or the name of the project that contains the field that you want to delete.

  5. When you have completed your search criteria, click Open or press enter.

  6. Right-click the field that you want to delete from the list of field names displayed.

  7. Select Delete from the pop-up menu.

If you plan to make changes to your field definitions, you should view your field definition before you proceed. You can view it on your screen or print it to a one-page report that combines information from several resources. This method can also serve as a paper audit trail to document your database.

To print a field definition, select File > Print from the field definition window (or click the Print button in the toolbar) to open the Print dialog box, where you specify printing options. You can also print field definitions from the Open Definition dialog box. On the list resulting from your search, right-click the name of the field definition that you want to print, and select Print from the pop-up menu to view your printing options.