Specifying table and column properties

After you create and save a table, you can specify the properties of the table and of any or its columns. Table properties include the fonts used for headers, labels, and data, and a comment that you can associate with the table. Column properties include the text used for headers and labels, display formats, validation rules, and edit styles used for data (also known as a column's extended attributes), and a comment you can associate with the column.

Specifying table properties

In addition to adding a comment to associate with the table, you can choose the fonts that will be used to display information from the table in a DataWindow object. You can specify the font, point size, color, and style.

To specify table properties

  1. Do one of the following:

    • Highlight the table in either the Objects view or the Object Layout view and select Properties from the Object or pop-up menu.

    • Click the Properties button.

    • Drag and drop the table to the Object Details view.

    The properties for the table display in the Object Details view.

  2. Select a tab and specify properties:

    Select this tab

    To modify this property

    General

    Comments associated with the table

    Data Font

    Font for data retrieved from the database and displayed in the Results view by clicking a Data Manipulation button

    Heading Font

    Font for column identifiers used in grid, tabular, and n-up DataWindow objects displayed in the Results view by clicking a Data Manipulation button

    Label Font

    Font for column identifiers used in freeform DataWindow objects displayed in the Results view by clicking a Data Manipulation button


  3. Right-click on the Object Details view and select Save Changes from the pop-up menu.

    Any changes you made in the Object Details view are immediately saved to the table definition.

Specifying column extended attributes

In addition to adding a comment to associate with a column, you can specify extended attributes for each column. An extended attribute is information specific to PowerBuilder that enhances the definition of the column.

To specify extended attributes

  1. Do one of the following:

    • Highlight the column in either the Objects view or the Object Layout view and select Properties from the Object or pop-up menu.

    • Click the Properties button.

    • Drag and drop the column to the Object Details view.

  2. Select a tab and specify extended attribute values:

    Select this tab

    To modify these extended attributes

    General

    Column comments.

    Headers

    Label text used in free-form DataWindow objects.

    Header text used in tabular, grid, or n-up DataWindow objects.

    Display

    How the data is formatted in a DataWindow object as well as display height, width, and position. For example, you can associate a display format with a Revenue column so that its data displays with a leading dollar sign and negative numbers display in parentheses.

    Validation

    Criteria that a value must pass to be accepted in a DataWindow object. For example, you can associate a validation rule with a Salary column so that you can enter a value only within a particular range.

    The initial value for the column. You can select a value from the drop-down list. The initial value must be the same datatype as the column, must pass validation, and can be NULL only if NULL is allowed for the column.

    Edit Style

    How the column is presented in a DataWindow object. For example, you can display column values as radio buttons or in a drop-down list.


  3. Right-click on the Column property sheet and select Save Changes from the pop-up menu.

    Any changes you made in the property sheet are immediately saved to the table definition.

Overriding definitions

In the DataWindow painter, you can override the extended attributes specified in the Database painter for a particular DataWindow object.

How the information is stored

Extended attributes are stored in the PowerBuilder system tables in the database. PowerBuilder uses the information to display, present, and validate data in the Database painter and in DataWindow objects. When you create a view in the Database painter, the extended attributes of the table columns used in the view are used by default.

About display formats, edit styles, and validation rules

In the Database painter, you create display formats, edit styles, and validation rules. Whatever you create is then available for use with columns in tables in the database. You can see all the display formats, edit styles, and validation rules defined for the database in the Extended Attributes view.

For more information about defining, maintaining, and using these extended attributes, see Displaying and Validating Data.

About headings and labels

By default, PowerBuilder uses the column names as labels and headings, replacing any underscore characters with spaces and capitalizing each word in the name. For example, the default heading for the column Dept_name is Dept Name. To define multiple-line headings, press Ctrl+Enter to begin a new line.

Specifying additional properties for character columns

You can also set two additional properties for character columns on the Display property page: Case and Picture.

Specifying the displayed case

You can specify whether PowerBuilder converts the case of characters for a column in a DataWindow object.

To specify how character data should be displayed

  • On the Display property page, select a value in the Case drop-down list:

    Value

    Meaning

    Any

    Characters are displayed as they are entered

    UPPER

    Characters are converted to uppercase

    lower

    Characters are converted to lowercase


Specifying a column as a picture

You can specify that a character column can contain names of picture files.

To specify that column values are names of picture files

  1. On the Display property page, select the Picture check box.

    When the Picture check box is selected, PowerBuilder expects to find picture file names in the column and displays the contents of the picture file—not the name of the file—in reports and DataWindow objects.

    Because PowerBuilder cannot determine the size of the image until runtime, it sets both display height and display width to 0 when you select the Picture check box.

  2. Enter the size and the justification for the picture (optional).