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!

Total sum of column for a af:table

SamsonFuApr 12 2010 — edited Apr 13 2010
Hi all,

I am using JDeveloper 11g with ADF BC.

I've try to create a method in VO to iterate through all the rows to calculate sum as following:
        Row curItem = first();
        while (curItem!=null) {
            Long l = DbsDelegate.attributeAsLong(curItem.getAttribute("field1"));
            if (l != null)
                result+= l.longValue();
            curItem = next();
        }        
I found it is not a good practice. Since the cursor will jump to the last record after that. And most important, the next() method call will fire a NavigationEvent to registered RowSetListeners, by calling RowSetListener.navigated() as documented here: http://www.bisnis.com/doc/rt/oracle/jbo/server/ViewObjectImpl.html#next%28%29

Is there any better way to iterate through a VO and calculate some summary data?

Regards,
Samson Fu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 11 2010
Added on Apr 12 2010
1 comment
1,258 views