- Possible Values and the – All – Value

Possible Values and the – All – Value

In the above screen shot, notice that WOW has added in a special "– All –" value to the list of department numbers. The all option lets the user search for employees with any department number. However the "– All –" choice will only work correctly if your SQL has been coded properly to handle it.

The "– All –" value always corresponds to a NULL SQL value. This means if your SQL statement was SELECT * FROM PJDATA.EMPLOYEE WHERE WORKDEPT = ? and the user selected the "– All –" value, no rows would be returned. This is obviously an incorrect result. The proper SQL in this case would be SELECT * FROM PJDATA.EMPLOYEE WHERE WORKDEPT = COALESCE(CAST(? AS CHAR(3)),WORKDEPT). This SQL is written so that if the value supplied by the user is NULL, then all rows of the EMPLOYEE table are returned, regardless of the department number.

Customizing the – All – Item

Although WOW puts the "– All –" item into search parameters by default, you can change this text to anything you like, or even remove it altogether. This text is controlled by the dropDownItemDisplay property of the OperationLabels property group (property groups were covered earlier in this chapter).If you wanted the text to say "– Choose –" instead of "– All –" you would insert the following text into the properties field of your operation:

OperationLabels { dropDownItemDisplay: – Choose -; }

If you like, you can also instruct WOW to eliminate this extra item altogether. This is done by specifying NULL as the value of the dropDownItemDisplay property:

OperationLabels { dropDownItemDisplay: NULL; }

NOTE: The OperationLabels property group is specified with the regular current operation, NOT with the possible value operation.

Further Customizing the – All – Item

Whether you change how the "– All –" item is displayed or not, by default the value that is actually sent to WOW and placed in your query is the special null value. If you like, you can choose to have a different value placed into your query when this item is selected. Just specify the value you want using the dropDownItemValue property:

OperationLabels { dropDownItemDisplay: – Choose –; dropDownItemValue: Nothing; }

The above example would add an item to the possible values drop down with a display text of "– Choose –". When this item is selected, the value "Nothing" would be sent to WOW.

NOTE: You cannot specify a value for the dropDownItemValue property unless you also specify a value for the dropDownItemDisplay property.

The – All – Item in Details Display

The "– All –" value functions similarly within the Details display as it does in the search parameters. The OperationLabels {} property should still be used to modify the drop down display value if you want it to say something other than

"– All –". For instance:

OperationLabels { dropDownItemDisplay: -- Choose -- ; }

The above example would change the value of the empty Possible Value to say " -- Choose -- " rather than " -- All -- ".

Removing the – All – Item in a Search

To remove the "– All –" item from a search prompt, go to the FD of the relevant field and check the "Required on Search" box. This will remove the "– All –" option and force the user to select a value. This is particularly useful when you have two (or more) different drop down fields in one SQL operation and only want one field to have the "– All –" item. Rather than using the OperationsLabels feature which applies to all fields in the operation, you would use the "Required on Search" feature to selectively remove the "– All –" item.