Configuring Auto Complete Fields
In this section, we will configure an existing search field as an auto complete field. We will start
out with a simple SQL query which asks the user to enter in a state to search on. Here is the
SQL operation:
The CNTSTATE column in the database contains state abbreviations (two characters). So in
order to find any matches, the user will have to enter in a matching state abbreviation.
This is what the search screen looks like before auto complete is configured:
To use the auto complete feature, we must first create a possible values operation for the
auto complete field. This operation is responsible for taking what the user has entered in the
search field and returning the matching possible values. The returned possible values can
contain both an internal value (in the first column) and a display value (in the second column).
For example, when the user is searching for a state, the internal value may be "CA" and the
display value would be "California". Here is what our example possible values operation looks like:
The possible values operation will search a file containing both the state abbreviations and the
full state names, based on a partial state name entered by the user. This partial state name
will be pulled from the CNTSTATE field, which is the field that will be displayed on the screen by
the main search query. All possible values operations for auto complete fields should use a LIKE
comparison in the SQL, since the goal is to find all matches which begin with a value entered by
the user.
Our possible values operation returns the state abbreviation in the first column, since that is the
internal value required by our primary search. The second column contains the display value (the
full state name). The internal value will never be displayed on the screen - the display value is
shown in both the drop down and the search field. When data is sent to the database however,
WOW will always use the internal value and not the display value.
The next step is to configure the field descriptor for the auto complete field, which is the CNTSTATE
field in our example. The display component should be set to Auto Complete, and we must also select
the possible values operation we created. In this example we also need to adjust the field size from 2
to 15. The field size was set to 2 when WOW created the field descriptor, since the column holding
the state abbreviations in the database can only hold 2 chars. However we want to allow the field to
contain the full state name and not just the abbreviation, so we have to increase the field size. This
only affects the field within WOW - the database table can still only hold 2 characters.
After making the above changes to the field descriptor, our auto complete field is now ready
to go. We can run the search, and as we type values into the search field WOW will run the
possible values operation to retrieve the possible values matching what has been entered in
the field and display them in the drop down.