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!

How to Clear ViewObject Rows Programmatically?

490060Jun 27 2006 — edited Jun 30 2006
Within an Application Module service method I execute a query for View Object #1 (VO1.) Output from the VO1 query is used to create the where clause params for VO2 which is executed following VO1. If VO1 query produces no rows, I want to clear any existing rows from VO2. I've tried using VO2.appViewCriteria(null) as suggested on previous posts, but this has no affect and does not clear out or hide VO2's existing rows? I'm guessing this doesn't work because I'm not using ViewCriteria to filter the rows, but rather using where clause params? Any recommendations on what method to use to clear a View Object's existing rowset? Do I need to do anything on the .jspx / JSF side to re-display the new (empty) table contents since I don't leave or re-load the page? Thanks!

--------- Here is the code from the AM method --------------------
ViewObject vo1 = findViewObject("ViewObject1");
vo1.setWhereClauseParam(0, zip);
vo1.setMaxFetchSize(1);
vo1.executeQuery();

// if user enters invalid zipcode 0 rows will be returned
if (vo1.getEstimatedRowCount() < 1) {
ViewObject vo2 = findViewObject("ViewObject2");
vo2.applyViewCriteria(null); // this does not clear the existing rows in vo2!!
vo2.executeQuery();
}
else { // vo1 returned rows; use results as where clause params for vo2
Row rw = vo1.first();
float lat1 = (Float)rw.getAttribute("Latitude");
float long1 = (Float)rw.getAttribute("Longitude");
ViewObject vo2 = findViewObject("ViewObject2");
vo2.setWhereClauseParam(0, lat1);
vo2.setWhereClauseParam(1, long1);
vo2.setWhereClauseParam(2, long1);
vo2.executeQuery();
}
return;

Message was edited by:
javaX
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2006
Added on Jun 27 2006
7 comments
2,237 views