Saturday, February 9, 2013

ADF: Searching with ID while displaying Name in Query Panel

Adding attributes into query panel is simple, just adding them to the view criteria would automatically add the attributes into the query panel. This works for most types of component types i.e inputText, inputDate, chioceList, selectBooleanChoice etc. There is an additional step if you need to add a search attribute of type ListOfValues or ComboListOfValues and use corresponding ID for search.

1. Add a transient attribute into the view Object.


2. Add a view accessor and define the LOV on the  DepartmentName attribute.





3. Define a new view criteria and add the transient attribute DepartmentName and the corresponding Query attribute into the ViewCriteria.



4. Hide the DepartmentId in the query panel. Now when you search for employees using the deparmentName, search query is built using the Id attribute. (This would help the query performance by picking up index defined on the ID attribute if any.)



5. Search by Department Name.



You can download the complete example here.

2 comments:

  1. This is not good
    read this
    http://docs.oracle.com/cd/E21043_01/bi.1111/e10541/adf_labels_tips.htm

    ReplyDelete
  2. Updated the blog for clarity, thanks for the feedback.

    The case here for example: searching with DeparatmentName. Once "Human Resources" is selected in the ListOfValues, the blog entry shows how to use the corresponding ID to create the where clause.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...