One of the new ADF BC features in ADF 12c - Row Finder. Row Finder acts as a helper for View Criteria to pass bind variable values and call query functionality. Important technical detail - instead of changing original rowset displayed on ADF UI, Row Finder creates and returns new rowset for results. This allows to search and get results with the same VO instance in parallel to the data displayed on ADF UI, without affecting original rowset accessed through bindings. At the moment it is possible to invoke Row Finder only programmatically through ADF BC API.
Here you can download sample application where Row Finder is implemented - RowFinderApp.zip.
When implementing Row Finder, firstly you need to define View Criteria. Here is View Criteria from sample application - filtering by First Name:
Once View Criteria is in place, you can go and define Row Finder (you must have View Criteria defined first). Set mapping between Bind Variables included into View Criteria and Attributes from where value is supposed to be supplied on runtime:
Later when invoking Row Finder through ADF BC API, we will need to set Attribute List with Attribute name and value pair.
There is custom method created in VO implementation class, this is where we call Row Finder:
Here is Row Finder invocation API example. Row Finder is invoked through execute(AttributeList, VO) method. We need to supply value for attribute name defined in Row Finder wizard previously. I'm getting value from current row. As you can see - Row Finder creates and returns another row iterator, without affecting original rowset of current VO instance. Basically it call new SQL query:
Custom method returns value - number of rows matching First Name from current row and is referenced from ADF bindings:
Later we display number of filtered rows in the popup on ADF UI. Here you can see example for 'David' - 3 rows located:
There are 9 rows for 'D':
The best of all - displayed rowset is not affected, we can move to another record and see that it comes from original rowset - 'Bruce':
Here you can download sample application where Row Finder is implemented - RowFinderApp.zip.
When implementing Row Finder, firstly you need to define View Criteria. Here is View Criteria from sample application - filtering by First Name:
Once View Criteria is in place, you can go and define Row Finder (you must have View Criteria defined first). Set mapping between Bind Variables included into View Criteria and Attributes from where value is supposed to be supplied on runtime:
Later when invoking Row Finder through ADF BC API, we will need to set Attribute List with Attribute name and value pair.
There is custom method created in VO implementation class, this is where we call Row Finder:
Here is Row Finder invocation API example. Row Finder is invoked through execute(AttributeList, VO) method. We need to supply value for attribute name defined in Row Finder wizard previously. I'm getting value from current row. As you can see - Row Finder creates and returns another row iterator, without affecting original rowset of current VO instance. Basically it call new SQL query:
Custom method returns value - number of rows matching First Name from current row and is referenced from ADF bindings:
Later we display number of filtered rows in the popup on ADF UI. Here you can see example for 'David' - 3 rows located:
There are 9 rows for 'D':
The best of all - displayed rowset is not affected, we can move to another record and see that it comes from original rowset - 'Bruce':
Hi Andrejus,
ReplyDeleteRowfinders should use a transient attributes for searching. In the example you've provided, you would always get a matching row count as 1 even if there are no matching rows in the table. Because, when you change an attribute to find matching rows, it infact changes (submits) the actual value of the attribute. This can be avoided when using a transient attribute. More info here : http://docs.oracle.com/middleware/1212/adf/ADFFD/bcquerying.htm#BCGFFEEI
Regards,
Arun
Thanks for update, this is correct. This sample was implemented with previous 12c release and I think there was no proper documentation at that time.
ReplyDeleteRegards,
Andrejus
great post, thanks.
ReplyDeleteAndrejus,
ReplyDeleteIt doesnt seem to work if the criteria has a non-bind variable based criteria row. Is there any such known restriction if the criteria row has a condition based on a value instead of a bindVariable?
Btw, if I modify the criteria row to use a bindvariable and have the variable value set by default, it works fine.
Rgds, Ajay
Hi Andrejus,
ReplyDeleteIs there any feature in ADF BC REST to require a parameter to a query (ex: required bind variables)? I'm able to create a required bind variable in my View Object but I cannot find a way to expose this in my service. The Row Finder only works if we need to filter by one row.
Thanks,
Alex