Possible Value Keys
WOW also comes with several predefined Possible Values. There are Possible Values for US States, days of the week, and several other common scenarios. To select one of these predefined possible values for a field, use the Possible Values Key drop down in the field descriptor.
It is also possible to create your own possible values keys and have them appear alongside the predefined keys in the drop down. The process of creating your own possible values keys is described in the Possible Values section of the WOW Utilities chapter.
Possible Values Selector
This operation is very powerful but requires a few steps in order to utilize. This operation is capable of setting several field values in a row based on the selection of a possible value. Consider an "order"; an order normally requires many fields to be set in the order header record. These fields may include the customer number, customer name, shipping address, etc. When you select the customer for an order, you want to "select" other fields to be copied into the row.
The SQL specified in this operation retrieves the Possible Values for the field and displays them like a normal Possible Values operation. The difference for the Possible Values Selector is when the user selects a value from the Possible Values drop-down, a call is made to the server which calls the method "handlePossibleValueOperation" on the field associated with this operation. The default behavior is to copy the values of the operation's SQL query via common usage id into the source row. The user may also specify to copy via common field name. This setting is determined by the value of the "copyRule" property of the Display Groupings Property Group. The valid values for this property are usageid and fieldNames.
For the following example, consider the following 2 tables:
Customer file
Order File
Follow these steps to utilize this operation:
Typically you will have a normal SQL edit or insert operation. Example:
INSERT INTO mylibrary.myOrderFile.
Create an operation of type PossibleValueSelector with the following SQL:
SELECT customerId AS OrderCustId, lastName || firstName AS FullName, lastName AS OrdLastName, firstName AS OrdFirstName, custZip AS OrdCustZip FROM myLib.customerFile
Notice the use of the "as" feature to map customer field names to their corresponding order field names. WOW can now copy the fields from the Customer file into their matching fields in the Order file.
Also, it is very important to note that the first two columns selected behave just like a normal PV Operation. The first column is the internal value while the second column is its corresponding external value. In the case above, the customer ID (internal value) is masked by the customer's full name (external value). This only applies to the first two columns. the remaining selected columns only contain internal values.
In the properties of this operation, you must tell WOW to map using the field names. You can do this by specifying the following property group:
PossibleValues{copyRule:fieldNames;}
Now open the field descriptor on the "OrderCustId" field and set the possible value operation field to the operation created in step 2. Also, set the field descriptor's "Status Change" to yes, which will force a screen refresh when a new value is selected. At this time, WOW will attempt to copy the fields from the possible value row to your current row.
As an alternative, you can also set the usage ID values in both the customer and order file and WOW will copy the fields that have matching usage ID values. In this scenario you would specify the following property group:
PossibleValues{copyRule:usageid;}