Defining the List of Values
To define a list of values and attach it to an attribute in a view object, perform the following steps:
1. Create a list of values on the view object attribute that points to the view accessor. To do so, you select the attribute on the Attributes panel, expand the List of Values header, and click Add (the green plus icon.) The slide shows creating an LOV on the PersonTypeCode attribute in the PersonVO view object.
2. In the List of Values dialog box, select the view accessor to use as the List Data Source, along with the attribute to populate the view object’s attribute. The example uses LookupCode from the PersonEO.LookupCodeVVO1 view accessor to populate PersonTypeCode in the PersonVO view object. Note: If you had not already created the view accessor, you could click Add (the green plus icon) in this dialog box to create one.
3. On the UI Hints tab of the List of Values dialog box, you select the list type to use as a default, the attribute or attributes to display in the list, whether selection is required, and how to display a “No Selection” item in the list if selection is not required. In the example, the Meaning attribute is selected to display in the list, and selection is required.
4. The list of values automatically renders as a drop-down list at run time.
You can optionally create a List validator on the entity attribute that points to the view accessor. Adding a validator is explained in the lesson titled “Validating User Input.”