Thursday 11 September 2014

af:query operators

One of few tricks that I'd like do talk about refers to advanced mode of af:query component. Each queryable attribute (property of an attribute at view object level) can be a part of SQL where clause. In basic mode framework builds the query with default equal operator. In advanced mode user can pick an operator from the list. By default we've got 14 operators which, for plain business user, may sounds silly. For example how to compare surnames using "Greater than" operator. What do i get as a result?

To cut the list of such "silly" operators you need to go to the view objects source. It is not possible to acheive it using wizards. The trick requires to add CompOper sub-nodes to the specified queryable ViewAttribute with additional proper values.



Each CompOper node has several flags. ToDo flag with -1 value means that the operator will be removed from the list. I've removed most of the "silly" operators. I've also defined one "less-silly" operator just to check if adding works as nice as removing. In the source code screenshot it's the node with ToDo="1".

Test page is build as drag&drop All Queriable Attributes from iterator's Named Criteria package in the Data Control to the Design section as ADF Query Panel with Table. Run the example:



Plain and simple, isn't it? Where to get more information about it? First place that you need to visit is the Fusion Middleware Developer's Guide documentation itself on http://docs.oracle.com/cd/E14571_01/web.1111/b31974/web_search_bc.htm#ADFFD2457. And how to solve operators' names? Not need to guess, they're described in oracle.jbo.common.JboCompOper table of Java API of ADF Model that can be found on http://docs.oracle.com/cd/E15051_01/apirefs.1111/e10653/constant-values.html.

No comments:

Post a Comment