We have noticed in our application a bug that when we enter a page that has af:query with bind variable, after ExecuteWithParams, it always keeps the first value that we first entered the page.
I reproduced this bug in a simple Departments Employees Test case:
In Employees View object i have a query criteria for DepartmentId = :inDepId. In the taskflow that opens the Employees query page i first run ExecuteWithParams for the task flow input paramter.
When i run application in the main page i select a department and then i pass DepartmentId as input value to the Employees task flow.
The first time i call Employees task flow everything works fine. The value of input parameter is set in the criteria and Employees of that department are queried:
But when i return to departments and select an other department and go to Employees again, the bind Variable in Query criteria is still the same, Even though the input parameter and the results have changed for the new department.
Isn't this realy strange?
If i change value and press reset it allways return to the first value that af:query is executed.
I tried in bindings refresh conditions and TrackQueryPerformed="Page" with no luck.
Is this a bug?
Is there a workaround?
Test case:
http://adfbugs.googlecode.com/files/TestViewCriteriaBug.zip
Filed bug# 8809022 with your testcase, thanks.
ReplyDeleteWORKAROUND
----------
Rather than using the ExecuteWithParams action as the task flow's
initial activity, instead write a custom AM method that you publish
on the AM's client interface that does the following:
public void initTaskFlowDefinition(Number deptno) {
// Set var value on VO's variable manager
getEmployeesView1().
ensureVariableManager().
setVariableValue("inDepId",deptno);
// Save the save of the view criteria to "remember"
// the current var values as the ones to be restored
// in the search form.
getEmployeesView1().
getViewCriteriaManager().
getViewCriteria("EmployeesViewCriteria").
saveState();
}
Then, have the task flow's default activity invoke this AM
method instead to accomplish the task.
thanks a lot for workaround, i will try it
ReplyDeleteThanks for posting this. We had a similar problem and this helped lead us to the solution. In our case, the View Object did not have View Criteria -- the bind variable was required and hardcoded into the where clause of the query. So, using Steve's code as inspiration, we found that the following works to update the value and also passivates properly:
ReplyDeleteViewObject vo = this.getMyViewObject();
VariableValueManager vm = vo.ensureVariableManager();
vm.setVariableValue("MyVar",theValue);
//This next line obviously would need to change
//if you had more than one possible bind
//variable, but works for our situation.
Variable var = vm.getVariables()[0];
vm.variableChanged(var);
I don't know if this is exactly the best way to do this, but calling that variableChanged method seems to make all the difference. Hope this helps.
Hi ,
ReplyDeleteWe have a regional area with a search button. Onclick of search we open a taskflow that displays the result page in the main area. The result page has a query panel and result component (table). Disclosed property of query panel is bound to a taskflow parameter.Now I observe that,
By default,the query panel disclosed is false. Now the state is changed by opening the query panel. Next time when the search button is clicked from the regional area, the result page should be rendered in the main area with disclosed = false. But still the query panel is retaining the previous state of disclosed=true. This state is retained till the application is refershed. When we print the boolean value we found it to be coming correctly.
Any pointers on refreshing this value?
I have tried setting the disclosed property in bean through bindings and added partial targets. It doesn't help.
Also I observe that this value is retained only for that particular main task. It is not retained for session. If we closed the task and search again it comes with expected value. When we work with the task already open and user manipulation this happens.
Thanks
Fixed in 11.1.1.3
ReplyDeleteHi,
ReplyDeletein 11.1.1.3, go to "Bindings" of the page "Main.jspx" and select "DepartmentsView1Iterator" at the Executables and set the property Refresh "ifNeeded". It works fine.
Ilhan