As you might know that i came from 4GL background and these days i am exploring Oracle ADF.
Subject:
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
Solution:
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 = (DCIteratorBinding)bc.findIteratorBinding("AdfCalendarINSERTIterator"); // 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) rsi.setCurrentRow(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,
Baig
Hi Baig,
ReplyDeleteThanks for very simple and useful code.
Regards,
Daki
Hi, im Sandeep,could you tell me the way to delete a row set from table based on choosing a condition?
ReplyDeleteHi sandeep,
ReplyDeletePlease check this post this might help you http://www.baigzeeshan.com/2010/06/deleting-multi-selected-rows-from-adf.html
ZB
Hi Baig,
DeleteMy 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?
infantafdo, I have this same issue. Did you ever find a solution?
DeleteDCIteratorBinding 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 ?
ReplyDeleteHi,
DeleteSorry for late response. That method is for internal use only oracle does not recommend developers to use it.
http://docs.oracle.com/cd/E15051_01/apirefs.1111/e10653/oracle/adf/model/binding/DCIteratorBinding.html#findRowByKeyString%28java.lang.String%29
Excellent!!!
ReplyDeleteYour piece of code works like a charm. Keep up the good work...
Regards
Ahmed