Tuesday, March 23, 2010

ADF-How to find rows in an Iterator

Hi all,
As you might know that i came from 4GL background and these days i am exploring Oracle ADF.


I am working on Sample Calendar application which i will post when i will complete it.
In that application I have 2 iterators named AdfCalendarIterator and AdfCalendarINSERTIterator based on same View object called AdfCalendarVO

I have created 2 instances of VO to separate CRUD (Create Read Update Delete) operations.

I was not able to find simple solution on Google so i decided to share for ADF newbies 

On Managed bean write something similar
Note: I modified the example for understandability we assumed that we have only 1 column primary key

   //Primary key value if you have Number then replace with anotherVariable
    String currid = "A001"; 
    // 1. Access the binding container
    DCBindingContainer bc = (DCBindingContainer)getBindings();
   // 2. Find a named iterator binding
    DCIteratorBinding iter =
    // 3. Create a Key object 
    Key key = new Key(new Object[] { currid });
    //4. Get the RowSetIterator Object
    RowSetIterator rsi = iter.getRowSetIterator();
    //5. Find the row in the Iterator using findByKey funtion by passing Key object
    Row row = rsi.findByKey(key, 1)[0];
   // 6. Set the Current row in Iterator (findByKey does not Navigate to current row)

For more detail on particular function or procedure right click on it in JDeveloper and select Go to Javadoc... also check Oracle Fusion Developer guide

Feel free to comment and post better examples.

Happy learning,


  1. Hi Baig,
    Thanks for very simple and useful code.


  2. Hi, im Sandeep,could you tell me the way to delete a row set from table based on choosing a condition?

  3. Hi sandeep,

    Please check this post this might help you http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-adf.html


    1. Hi Baig,
      My case is, I want to insert into a table a set of values (4 fields) only if a particular field is not already present. If it is already there, i just need to update other fields. How to do this using findbykey()? Could you please tell me?

    2. infantafdo, I have this same issue. Did you ever find a solution?

  4. DCIteratorBinding class has a similar naming method findRowByKeyString. but i haven't successfully use this method nor your tutorial. have u ever try the findRowByKeyString method ?

    1. Hi,

      Sorry for late response. That method is for internal use only oracle does not recommend developers to use it.