Possible Values
Possible Values are a crucial part of WOW. When a field has possible values, the application will display a drop down menu with the values that are possible for the field. This is important because it allows the user to pick a specific value instead of typing in a value that may or may not be valid. For example, let's say we want to create possible values so that when a user searches for an employee by department number, they can pick the department number from a drop down list of all department numbers.
To create Possible Values with WOW, you first need to create field descriptors for the table with which the possible values will be associated. In our example, this is the EMPLOYEE table. Once your table has field descriptors, the next step is to add a possible values operation to your application. To create a possible values operation, click on the "Create Operation" link that is visible when viewing a list of your application's operations.
Below is an example of setting up a possible values operation:
To setup a possible values SQL operation, the Operation Type must be set to Possible Values. The SQL command above will select all of the distinct DEPTNO fields from the DEPARTMENT table (these are the values that the user will be able to choose from). DISTINCT is used so there is only one instance of each DEPTNO value.
After you have created the Possible Values Operation, you need to associate it with a specific field. This will be very similar to setting up Associations as described in the Association section of this guide. To associate our PV operation with a specific field, we will first run a query on the EMPLOYEE table to display all of its rows. The result will look similar to the screenshot below:
In the example above, we are setting up Possible Values for the WORKDEPT column. To setup the Possible Values, click on the 'gear' icon on the immediate right of the WORKDEPT column name. This will bring up the Field Descriptor Manager application in a new window. The only section we'll pay attention to will be the Possible Values Settings, which looks similar to the screenshot shown below:
To complete your Possible Values, find the correct Possible Value that is listed under the Possible Values Operation (in the example, the "Dept # PV" was chosen). The Operations listed are all Possible Value Operations that have been created for your specific WOW application. After finding the corresponding Possible Value Operation, update the screen and your Possible Value will be setup and ready to use.
Now when we run an operation with this code:
SELECT * FROM PJDATA.EMPLOYEE WHERE WORKDEPT = ?
we will get a drop down with all the possible department numbers available:
Note: Consider creating a derived field for any Possible Values Operation you wish to use or set on a field. This will greatly save you time in the future should you choose to use these fields for multiple purposes. Using your original fields from your database can and will affect any other types of actions you wish to add to those fields in the future such as Associations as well as just simple queries that will display a different value than desired.
TAGS: drop down list, drop down, pick list