Saturday, July 25, 2009

TrackQueryPerformed Property Usage and ADF Task Flows

I will describe following scenario - two ADF Task Flows, second ADF Task Flow is opened as Isolated. First ADF Task Flow provides query functionality implemented as View Criteria, and second ADF Task Flow accepts current row key value and allows to edit data. Scenario is pretty simple, and can be implemented in Oracle ADF very fast. However, there is one trick if you open second ADF Task Flow as Isolated. I will describe it and provide solution.

At first, download sample application I have developed - TrackQueryPerformed.zip. First ADF Task Flow provides query screen and calls second ADF Task Flow. Nothing specific here:


Second ADF Task Flow is also basic, just using Method Call for setCurrentRowWithKeyValue action:


Only one thing, second ADF Task Flow is defined with Isolated Data Control Scope:


In some systems, its usual requirement to open CRUD style ADF Task Flow in Isolated mode, in order to get a new DataControlFrame for CRUD operations.

Ok, so far everything is simple and good. Let's open query page and select third record in results table:


When record is selected, press Edit button to navigate to a second ADF Task Flow, selected record is opened for editing:


Change First Name value, press Save to commit changes and navigate back by pressing Close. Data was updated, but when navigating back to query page it was not refreshed there (same data in third row as before):


In order to requery data correctly when navigating back, we need to change TrackQueryPerformed property value in Page Definition file for Query Criteria binding:


Change it from default PageFlow to Page:


This means, Query Criteria will be initialized and performed automatically each time query page will be opened, its what we need in our case. With this setting, when navigating back from Isolated scope CRUD ADF Task Flow to query ADF Task Flow, data changes will be retrieved and shown automatically (data in third row is up-to-date):

4 comments:

Anonymous said...

Thanks for explaining the "trackQueryPerformed" feature.
But I have a question on the example you used. Suppose that I do the following steps:
1. In the fist page (search page), I enter a search criteria in such a way that only one record is queried.
2. Select that record to edit, make the modifications (in the next page) and save the record.

Now, when returning to the first page, the results table shows all the records in the DB and not the only record queried earlier. Am I correct?

Andrej Baranovskij said...

Hi,

Yes, you are correct. By default, it will return all records. However, you can set search parameter programatically, it will filter then.

Regards,
Andrejus

Anonymous said...

in above scenario "results table shows all the records" can you provide some direction/ sample code on how one would re-query the search results table when VO criteria "Automatically Execute" checkbox is unchecked.
Basically equivalent of "Search" button during page load.

Nidhi said...

Hi
I have one Taskflow which has two pages. In first jsff page one column of the query table is a link to second jsff page.
On return from the second page I need to show the fresh data in the table present on first page and the query should be maintained.

I am using a VO based on sql query.
Using TrackQueryPerformed on return from the other page no data is visible in the table.
Also in the View Criteria the Query Automatically option is disabled.