Populating Drop-Down Lists Dynamically

You can populate the contents of a drop-down list characteristic in three ways:

Note:

See "Overriding Values for Drop Down List Characteristics" for information about defining values for drop down lists at the Specification editor level.

Populating a Drop-Down list with Static Values

You can populate a drop-down list with values that do not change.

To populate a drop-down list with static values:

  1. From the Studio menu, select Show Design Perspective.

  2. Click the Dictionary tab.

  3. Select the data element that you want to tag as a characteristic.

    The Data Element tab appears in the Data Schema editor.

  4. Click the Settings tab.

  5. In the Control Type field, ensure that the DropDown value is selected.

    See ”About Control Types” for more information.

  6. Click the Characteristics tab.

    The fields on this tab are read-only if the data element is not tagged as a characteristic. See "Tagging Data Elements as Characteristics" for more information.

  7. In the Data Values area, select Enumerations.

  8. Click the Enumerations tab.

  9. Click Add.

    Design Studio creates a new row in the Included table and uses placeholder text for the Code and Description values.

  10. Click the placeholder text in the Code or Description columns.

    The placeholder text becomes editable.

  11. Edit the placeholder text.

    The contents of these fields are stored in the database, but only the Description field is displayed to the user in UIM. For example, you may want Red as the label displayed to the user, but 1 as the value stored in the database.

    You can enter text in the Code field without entering text in the Description field. In this case, the Code text is displayed.

  12. (Optional) To make the enumeration the default value in the run-time environment, click inside the Default column and select Yes.

  13. (Optional) To remove a value from the table, select any value and click Remove.

  14. From the File menu, select Save.

Populating Drop-Down Lists with Entity Links Using Existing Specifications

Entity links enable you to populate the drop-down list with the names of all entities created from the selected specification. For example, if you specify a Logical Device specification named Customer Edge Router, the drop-down list includes the names of all Logical Device instances created from the Customer Edge Router specification.

Also, you can use SQL commands to filter the entity instances for a selected entity link. By default, the drop-down list is populated with label and value pairs. For example, if you define a Logical Device instance with the ID 1234 and with the name as LD1, the label in drop-down displays 1234-LD1. You can change the default behavior of a drop-down label by writing the custom extension for the following API:

CharacteristicHelper.getEntityLinkDisplaySelectSQL()

To populate a drop-down list with the names of entity instances created from an existing specification:

  1. From the Studio menu, select Show Design Perspective.

  2. Click the Dictionary tab.

  3. Select the data element that you want to tag as a characteristic.

    The Data Element tab appears in the Data Schema editor.

  4. Click the Settings tab.

  5. In the Control Type field, ensure that DropDown is selected.

    See ”About Control Types” for more information.

  6. Click the Characteristics tab.

    The fields on this tab are read-only if the data element is not tagged as a characteristic. See "Tagging Data Elements as Characteristics" for more information.

  7. In the Drop Down Options field, select Entity Link.

  8. In the Entity Link area, click Select.

    The Entity Selection dialog box appears, containing a list of available specifications.

  9. Select a specification in the list.

    To shorten the list of specifications, enter characters in the Select an item to open field. The list displays specifications whose names begin with the characters you enter. You can use the wildcard characters shown in the dialog box.

  10. Click OK.

    The specification you selected is displayed in the Entity Link area.

  11. (Optional) To view the selected specification in its editor, click the Entity link.

  12. (Optional) To remove a selected specification from the Entity Link area, click Clear.

  13. (Optional) In the Parameters field, do one of the following:

    • To select a characteristic to use in a filtered SQL query, click Select. The Add Element Selection dialog box appears.

      When you use a filtered data query, you must use the following syntax to indicate where in the query the characteristic parameter is to be used:

      :Characteristic Parameter Name

      For example, if you select Char1 in the Parameters table, then you would include the following parameter binding in the additional SQL filter:

      :Char1

    • To create a new characteristic for use in the filtered data query, click the Parameter link.

      The Create Data Schema Element dialog box appears.

  14. (Optional) To enter an additional SQL filter, enter the filter in the Body field.

  15. From the File menu, select Save.

Populating Drop-Down Lists with Entity Links Using New Specifications

Entity links enable you to populate the drop-down list with the names of all entities created from the selected specification. For example, if you specify a Logical Device specification named Customer Edge Router, the drop-down list includes the names of all Logical Device instances created from the Customer Edge Router specification.

To populate a drop-down list with the names of entity instances created from a new specification:

  1. From the Studio menu, select Show Design Perspective.

  2. Click the Dictionary tab.

  3. Select the data element that you want to tag as a characteristic.

    The Data Element tab appears in the Data Schema editor.

  4. Click the Settings tab.

  5. In the Control Type field, ensure that DropDown is selected.

    See ”About Control Types” for more information.

  6. Click the Characteristics tab.

    The fields on this tab are read-only if the data element is not tagged as a characteristic. See "Tagging Data Elements as Characteristics" for more information.

  7. In the Drop Down Options field, select Entity Link.

  8. In the Entity Link area, click the Entity link.

    The New Studio Entity dialog box appears.

  9. Select an entity type, then click Next.

    The Entity Specification Wizard appears. See "Creating New Specifications" for more information.

  10. Configure the properties of the new specification.

    See "Specification Editor" for more information.

  11. When you finish configuring the new specification, return to the Data Schema editor.

    The new specification is displayed in the Entity Link area.

  12. From the File menu, select Save.

Populating Drop-Down Lists with Query Results

You can populate drop-down lists with the results of a query that you define. You use Java Persistence Query Language (JPQL) or SQL commands to write the query to search for values that are stored in instance data.

For example, you can create a City Name characteristic as a drop-down list populated with all Place entities created from the City specification.

The JPQL query for this data is as follows:

Select name from GeographicPlace where specification.name.contains(”City”)

You can also populate a drop-down list with the results of pre-defined query that returns all authorized UIM users.

To populate a drop-down list from the results of a query:

  1. From the Studio menu, select Show Design Perspective.

  2. Click the Dictionary tab.

  3. Select the data element that you want to tag as a characteristic.

    The Data Element tab appears in the Data Schema editor.

  4. Click the Settings tab.

  5. In the Control Type field, ensure that DropDown is selected.

  6. Click the Characteristics tab.

  7. In the Drop Down Options field, select Query.

  8. In the Data Source field, select JPQL, SQL or USERS.

  9. (Optional) If you selected JPQL or SQL, do one of the following:

    • Click Select.

      The Element Selection dialog box appears. You can select a characteristic to use in a filtered data query. When you use a filtered data query, you must include a question mark(?) in the query string a to indicate where in the query the characteristic parameter is to be used.

    • Click the Parameter link.

      The Create Data Schema Element dialog box appears. You can create a new characteristic for use in the filtered data query.

  10. If you selected JPQL or SQL, enter a query in Body field.

  11. From the File menu, select Save.