Showing posts with label set current row key. Show all posts
Showing posts with label set current row key. Show all posts

Apr 8, 2016

Programmatically get and set Iterator Key value from Managed Bean

Sometimes we need to set current row after performing some action like Rollback or Execute.



BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding) bindings.get("EmployeesIterator");
oracle.jbo.Key empKey = null;

// get key value of current row

                if (iter.getEstimatedRowCount() > 1) {
                    if (iter.getCurrentRow() != null) {
                        empKey = iter.getCurrentRow().getKey();
                    }
                }

// Perform action you want to do here

// set ket value of current row

            if (empKey != null) {
                iter.setCurrentRowWithKey(empKey.toStringFormat(true));
            }