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?

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 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 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.

4 thoughts on “JDeveloper & ADF af:inputListOfValues: enable case insensitive search

    • See the image ‘EmployeesView: use own view criteria’. Here the view criteria is set. Once you open the dialog you’ll see the input text fields for hte variables. These are passed to the view criteria.

  1. Hi Timo – great article – is it possible for you to share where this code is in your github repo? The link above is not working anymore, and I was wondering if you maybe publish this in your github for us..


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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.