Skip to main content

Declaratively setting the current row key in a ViewObject

In this post I'm sharing simple example illustrating the declarative approach for overriding the default selected row of a ViewObject. Please take a look at the following screen shot, the row selection of the Department details displayed inside the 'paginated parameter form' changes in accordance with selection in the drop down list (displayed on the top of the screen). In other words, the row selection of a ViewObject for the parameter from changes in accordance with value from the drop down list.

A glance at the implementation

This example gets the row key of the currently selected item from selectOneChoice, and uses the same for setting the 'current row' for the ViewObject used for displaying parameter form in the task flow. Please note that, 'current row key' can be declaratively retrieved by making use of built in 'currentRowKeyString' method from iterator used for building the selectOneChoice. As I mentioned earlier, this key is passed as parameter to the task flow, displayed below the drop down list. This task flow is having 'SetCurrentRowWithKey'(from the DepartmentsViewObject iterator) as default activity, followed by a view activity to display the department and employee details. The 'SetCurrentRowWithKey' method call activity used in the above task flow is built by dragging and dropping the 'SetCurrentRowWithKey' operation displayed in the data control under the iterator used for building parameter form.

setCurrentRowWithKey: Tries to finds a row using the serialized string representation of row key passed as a parameter. If found, that row becomes the current row.

Please see topic '23.2.3 What You May Need to Know About Setting the Current Row in a Table' in Fusion Developer's Guide to lean more about 'SetCurrentRowWithKey'.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]


Taufeeq said…

How to set initial focus programatically in a table for the field when add button is clicked.
Hi Jobinesh,

Thanks for your solution. You are doing a great job. All your blogs are very useful. Carry on your great work.


Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…

Happy New Year 2018 !

We can't go back and change the beginning, but we always can start where we are and change the ending. Believe in yourself and you will be unstoppable!

Wishing you and your family a very happy new year 2018 !!!