JDeveloper & ADF af:inputListOfValues: enable case insensitive search

This blog entry describes a use case which is based on a question in the OTN JDeveloper & ADF forum.

Use case
In a data entry form there is one attribute which gets its values from an input list of values (af:inputListOfValues). The af:inputListOfValues component offers an input text field and a search facility which allows the use to look up the correct data. However, the look up uses a case sensitive search by default. The question is how to use a case insensitive search for the af:inputListOfValues to make the usability better for the user?

Implementation
The implementation of this use case can be done declarative, there is no java code needed. The sample, which you can download using the link provided at the end of the post, uses the Oracle HR schema to show how to do this. It build using JDeveloper 11.1.1.5.0 but should work in other versions too. We use the employees and jobs table from the HR schema. In the UI we use an input form for the employees and get the JobId via an af:inputListOfValues where the use can search for the right JobId.
The sample uses the default ‘Fusion Web Application’ application template as basis. The model project uses the two tables (employees and jobs) as business model. In the UI the search part of the af:inputListOfValues uses the ‘All Queriable Attributes’ for the search popup which is the automatically created view criteria for a view object. It shows all attributes of a view object which have the queriable property set to true. You find this property in the attribute section of the view object.
If you setup the LOV attribute in the emplyoees view object the default way, you end up with an inputListOfValues in the UI like:

inputListOfValue: Search popup using all queriable attributes

inputListOfValue: Search popup using all queriable attributes

Note that you have to use ‘A’ to find something. Using ‘a’ will not find anything. This is the problem we solve in this blog.

To implement an case insensitive search we have to create another view criteria in the Jobs view object. There we declare that we want to ‘Ignore Case’ for the attributes we are searching for. The final result of the view criteria looks like

JobsView: Create View Criteria

JobsView: Create View Criteria

Once this is saved we can open the EmployeesView and setup the model drivel LOV for the JobId of an employee row. Open the EmployeesView view object , select the Attributes node, select the JobId attribute and open the ‘List of Values’ for it. There we add a new entry resulting in the image below:

EmployeesView: setup LOV for JobId

EmployeesView: setup LOV for JobId

The essential part is to switch to the ‘UI Hints’ tab and there change the view criteria to use from ‘All Queriable Attributes’ to the view criteria created in the previous step.

EmployeesView: use own view criteria

EmployeesView: use own view criteria

Now after all is saved and compiled, lets run the application and see that the search popup for the af:inputListOfValues now uses our view criteria and indeed the search is case insensitive.

Search popup using case insensitive search

Search popup using case insensitive search

You can download the sample using this link: BlogCaseInsensitiveInputLOV.zip
The sample is build using JDev 11.1.1.5.0 and uses the HR schema.
The sample contains two pages Empdefault and Emp. Empdefault uses the normal LOV view criteria. The Emp page uses the view criteria created with case insensitive search.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s