Previous Topic: Specifying Attributes for the Project Entity

Next Topic: Using Inheritance to Define the Project Entity

Defining Field Properties

The fields you just defined represent character and date data types. These represent different kinds of fields. The identifier and description fields will hold text, and the start and end dates will hold dates. Currently, your model only indicates that these fields exist, and that they belong to the Project entity, but they have no information as to the type of data they store.

In the next step, you further define Project’s fields using inheritance. Inheritance is the mechanism that enables an object to adopt the properties of another more general object. For more information on this concept, see Inheritance in the chapter, "Introduction."

By inheriting from class library fields, you enable your application to:

To define the properties of Project’s fields:

  1. Make sure that the Object Browser is focused on fields, and that library objects are showing. For more information on showing library objects, see Show Library Objects in this chapter.
  2. Drag the Project ID field from the Object Browser to the source object field of the Model Editor (to select the object in the Object Browser, click the name, not the icon to the left of the name).

    Note: The cursor changes to a closed parcel icon PLEX--Defining Field Properties when you are dragging an object from the Object Browser. It changes to an open parcel icon PLEX--Defining Field Properties (2) when it is over an editor, or any area that can accept the object.

  3. From the verb list, select is a FLD.
  4. From the Object Browser, drag the library object OBASE/Code to the target object field, then press Enter.

    PLEX--Defining Field Properties (1)

    You just created the triple Project ID is a OBASE/Code. Click the Refresh button on the Object Browser. Notice that the Project ID field has a plus icon to the left, indicating that it now has scoped objects.

  5. Click the plus icon to expand the field. You can see that Project ID now has the values *Blank and *Not blank, but you cannot tell much else about what it inherited from OBASE/Code.

PLEX--Defining Field Properties (3)

  1. Drag the Project ID field from the Object Browser to the body of the Model Editor.

    When you drag one or more objects to the body of the Model Editor, the display changes to show you the triples that define those objects.

    PLEX--Defining Field Properties (9)

  2. If you want to make changes to an object and its scoped objects, but do not want to be distracted by information about the other objects in your model, use this drag and drop technique. To clear the focus so that all of the model’s objects are again displayed, click the Clear Focus toolbar button.

    When you drag the Project ID field to the Model Editor, it focuses on this field, showing the triple Project ID is a OBASE/Code. This triple still does not tell you much.

    PLEX--Defining Field Properties (10)

  3. To see more about what an object inherits from its ancestor objects, click the Two Levels toolbar button. The Model Editor changes to show another level of detail.

    PLEX--Defining Field Properties (6)

    Now, you can see that Project ID has inherited a data type of character and a length of six through the inheritance triple OBASE/Code is a OBASE/Character.

    Note: In Step 4, you dragged the library object OBASE/Code from the Object Browser to the Model Editor to enter it in the target object field. You can actually type the value into the target object field (without the library name) to accomplish the same thing.

Important! If you mistype the object name, you are likely to create a new object with the mistyped name.

PLEX--Defining Field Properties (11)

  1. Change the Model Editor display back to show a single level by clicking the One Level toolbar button.
  2. Reset the Model Editor display by clicking the Clear Focus button.

  3. Drag Project Description from the body of the Model Editor to the source object field.
  4. Enter Narrative in the target object field and press Enter.

    Notice that the Model Editor displays the triple as:

    Project Description is a OBASE/Narrative

    This indicates that you correctly spelled the class library field, as the Model Editor replaced your entry with the library object by the same name.

    Note: If you create a new object for a model, and it happens to share the name of a library object, you must rename your object or delete it (if you did not intend to create it).

  5. By default, fields that inherit from OBASE/Narrative have a specified length of 25. To enable your end users to specify a longer project description, add the following triple:

    Project Description length 30

  6. Now, using either the method explained in Steps 2 through 4, or the method explained in Steps 11 and 12, create the following triples:

    Project Start Date is a OBASE/ISO Date
    Project End Date is a OBASE/ISO Date

This inheritance gives the fields an ISO date format and includes built-in functionality to ensure that the date values end users enter are valid dates.

Use the process described in Steps 7 and 8 to look at the characteristics these fields inherited from the class library fields.