Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Best way to loop through View Object

Vladimir ZhilyaevOct 11 2016 — edited Oct 11 2016

Hi gurus,

I need to get each row of view object (100-200 rows). Google give this link. Do you agree with this article? If not please provide your solution.

May The ADF Be With You: Quick Tip: Best Way to Loop Through View Object Rows Programatically

Comments

Timo Hahn

User, tell us your jdev version, please!

Well, it's one way to do it (and not too bad). However, it always depends on hte use case. The method used in the blog allows you to navigate back and forth and holds all rows in memory. If you only want to visit each row, but don't plan to navigate (other than forward), you can use an optimized VO where you set the navigation in the VO to 'forward only'. Then for larger row sets page ranging is a better alternative as only one page of rows are read into memory.

Timo

Vladimir Zhilyaev

Hi, Timo.

Thanks for reply.

My jdev is 11.1.1.7.

My use case is "copy" view object data to other adf table. Which approach should I use?

This is my not working code:

  public void copyPayrolls1(ActionEvent actionEvent){

        DCIteratorBinding prlInfoIter = ADFUtils.findIterator("PayrollInfoIterator");

        DCIteratorBinding prlVOIter = ADFUtils.findIterator("PayrollVO1Iterator");

      

        RowSetIterator prlInfoRowSet = prlInfoIter.getRowSetIterator();

      

        ViewObject vo = prlVOIter.getViewObject();

        vo.executeQuery();

        while (vo.getRowSet().hasNext()) {

            Row newRow = prlInfoRowSet.createRow();

          

            newRow.setAttribute("payrollName",vo.getCurrentRow().getAttribute("PayrollName"));

            newRow.setAttribute("legalName",vo.getCurrentRow().getAttribute("LegalName"));

            newRow.setAttribute("payrollID",vo.getCurrentRow().getAttribute("PayrollId"));

            prlInfoRowSet.insertRow(newRow);

            System.out.println("asd");

        }

        prlInfoRowSet.closeRowSetIterator();

    }

Thanks

Timo Hahn

You can do it the way you coded it, if the number of rows to copy is small. For bigger row sets I would use a special VO whihc uses range paging amd only forward navigation.

Timo

1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 8 2016
Added on Oct 11 2016
3 comments
2,921 views