Creating an enumeration property

You define an enumeration property in an extension model file, and specify the enumeration values in an extension data file.

About this task

Attention:

Do not use a reserved SQL keyword as the name of a property.

Procedure

To create an enumeration property:

  1. Create or open an extension model file.
  2. In the Rule Model Extension Editor, right-click the extension model entry and then click New Child  > Enum.

    The tree displays a new Enum item.

  3. Select the Enum item and, in the Properties view, set the Name property to the name of the new enumeration.
  4. Right-click the rule model element to which you want to attach the enumeration property and then click New Child  > Property.

    The tree displays a new Property item.

  5. Select the Property item and, in the Properties view, set these properties:
    • Set the Name property to the name of the item as you want it to display in the Properties view.

    • Set the Type property to the name of the enumeration.

  6. Save the extension model file and then create or open an extension data file.
  7. In the Rule Model Extension Editor, right-click the extension data entry and then click New Child  > Enum Data.

    The tree displays a new Enum Data item.

  8. Select the Enum Data item and, in the Properties view, set these properties:
    • Set the Name property to the name you gave to the enumeration in the extension model file.

    • Set the Items property to the list of enumeration values.

  9. Save the extension data file.

Results

You have now created an enumeration property and attached it to a rule model element.

In XML, you create an enumeration property as follows:

  • In the extension model file:

    
      <class extends="ActionRule" name="MyRule">
        <property name="state" type="State"/>
      </class>
      <enum name="States"/>
    
  • In the extension data file:

    
      <enum-data name="State">
        <item>New York</item>
        <item>New Hampshire</item>
        <item>Rhode Island</item>
      </enum-data>