Extended Attributes (Profile)

Extended attributes define additional metadata to capture for object instances. You can specify a default value, allow users to freely enter numeric, string, or other types of data (or select objects), provide an open or closed list of possible values, or calculate a value.

Note: Extended attributes are listed on a generic Extended Attributes tab in the object property sheet, unless you insert them into forms (see Forms (Profile)). If all the extended attributes are allocated to forms, the generic page will not be displayed.
  1. Right-click a metaclass, stereotype, or criterion in the Profile category and select New > Extended Attribute.
  2. Specify the following properties as appropriate:

    Property

    Description

    Name

    Specifies the internal name of the attribute, which can be used for scripting.

    Label

    Specifies the display name of the attribute, which will appear in the PowerDesigner interface.

    Comment

    Provides additional information about the extended attribute.

    Data type

    Specifies the form of the data to be held by the extended attribute. You can choose from:
    • Boolean - TRUE or False.
    • Color - xxx xxx xxx where x is an integer between 0-255.
    • Date or Time - your local format as specified in your Windows regional settings
    • File or Path - cannot contain /// or any of the following characters: ?"<>|.
    • Integer or Float - the appropriate local format.
    • Hex - a hexadecimal.
    • Font - font name,font type,font size.
    • Font Name or Font Style - a 1-50 character string.
    • Font Size - an integer between 1-400.
    • Object - an object of the correct type and, if appropriate, with the correct stereotype. When selecting this type you must specify an Object type and, if appropriate, an Object stereotype, and you can also specify an Inverse collection name (see Linking Objects Through Extended Attributes).
    • Password - no restrictions.
    • String (single line) or Text (multi-line) - no restrictions.
    Select the Validate check box to the right of the list to enforce validation of the values entered for the attribute.

    To create your own data type, click the Create Extended Attribute Type tool to the right of the field (see Creating an Extended Attribute Type).

    Computed

    Specifies that the extended attribute is calculated from other values using VBScript on the Get Method Script, Set Method Script, and Global Script tabs. When you select this checkbox, you must choose between:
    • Read/Write (Get+Set methods)

    • Read only (Get method)

    In the following example script, the FileGroup computed extended attribute gets its value from and sets the value of the filegroup physical option of the object:
    Function %Get%(obj)
    %Get% = obj.GetPhysicalOptionValue("on/<filegroup>")
    End Function
    
    Sub %Set%(obj, value)
    obj.SetPhysicalOptionValue "on/<filegroup>", value
    End Sub

    Default value

    [if not computed] Specifies a default value for the attribute. You can specify the value in any of the following ways:
    • Enter the value directly in the list.

    • [predefined data types] Click the Ellipsis button to open a dialog listing possible values. For example, if the data type is set to Color, the Ellipsis button opens a palette window.

    • [user-defined data types] Select a value from the list.

    Template

    [if not computed] Specifies that the value of the attribute is to be evaluated as a GTL template at generation time. For example, if the value of the attribute is set to %Code%, it will be generated as the value of the code attribute of the relevant object.

    By default (when this checkbox is not selected), the attribute is evaluated literally, and a value of %Code% will be generated as the string %Code%.

    List of values

    Specifies a list of possible values for the attribute in one of the following ways:
    • Enter a static list of semi-colon-delimited values directly in the field.

    • Use the tools to the right of the list to create or select a GTL template to generate the list dynamically.

      If the attribute type is Object, and you do not want to filter the list of available objects in any way, you can leave this field blank.

      To perform a simple filter of the list of objects, use the .collection macro (see .object and .collection Macros). In the following example, only tables with the Generated attribute set to true will be available for selection:
      .collection(Model.Tables, %Generated%==true)
      For more complex filtering, use the foreach_item macro (see .foreach_item Macro):
      .foreach_item (Model.Tables)
         .if %Generated% 
         .// (or more complex criteria)
            %ObjectID%
         .endif
      .next (\n)

    If the attribute is based on an extended attribute type (see Creating an Extended Attribute Type), this field is unavailable since the values of the extended attribute type will be used.

    Complete

    Specifies that all possible values for the attribute are defined in the List of values, and that the user may not enter any other value.

    Edit method

    [if not Complete] Specifies a method to override the default action associated with the tool to the right of the field.

    This method is often used to apply a filter defined in the List of values field in the object picker. In the following example, only tables with the Generated attribute set to true will be available for selection:
    Sub %Method%(obj)
       
       Dim Mdl
       Set Mdl = obj.Model
       
       Dim Sel
       Set Sel = Mdl.CreateSelection
       
       If not (Sel is nothing) Then
          Dim table
          For Each table in Mdl.Tables
              if table.generated then
                  Sel.Objects.Add table
              end if
          Next
    
          ' Display the object picker on the selection
          Dim selObj
          set selObj = Sel.ShowObjectPicker
          If Not (selObj is Nothing) Then
             obj.SetExtendedAttribute "Storage-For-Each", selObj
           End If
          
          Sel.Delete
       End If
       
    End Sub

    Icon Set

    Specifies a set of icons to display on object symbols in place of extended attribute values (see Specifying Icons for Attribute Values).

    Text format

    [for Text data types only] Specifies the language contained within the text attribute. If you select any value other than plain Text, then an editor toolbar and (where appropriate) syntax coloring are provided in the associated form fields.

    Object type

    [for Object data types only] Specifies the type of the object that the attribute contains (for example, User, Table, Class).

    Object stereotype

    [for Object data types only] Specifies the stereotype that objects of this type must bear to be selectable.

    Inverse collection name

    [for Object data types only, if not computed] Specifies the name under which the links to the object will be listed on the Dependencies tab of the target object.

    An extended collection with the same name as the extended attribute, which handles these links, is automatically created for all non-computed extended attributes of the Object type, and is deleted when you delete the extended attribute, change its type, or select the Computed checkbox.

    Physical option

    [for [Physical Option] data types only] Specifies the physical option with which the attribute is associated. Click the ellipsis to the right of this field to select a physical option. For more information, see Adding DBMS Physical Options to Your Forms.



  3. Click Apply to save your changes.