In some cases you want to iterate through ViewObject, To do this you have two choice
1- Iterate through ViewObject and change current row in ViewObject
2- Iterate through ViewObject without changing current row
I will present a code snippet for every one
Assume that you will do this code in ApplicationModuleImpl class
1- Iterate through ViewObject and change current row in ViewObject
     ViewObjectImpl viewObject = getAllAdvisorView();  
     viewObject.executeQuery();  
     while (viewObject.hasNext()) {  
       Row row = viewObject.next();  
       // DO what do you want in Row  
     }  
2- Iterate through ViewObject without changing current row
     ViewObjectImpl viewObject = getAllAdvisorView();  
     RowSetIterator rsIterator = viewObject.createRowSetIterator(null);  
     rsIterator.reset();  
     while (rsIterator.hasNext()) {  
       Row row = rsIterator.next();  
       // DO what do you want in Row  
     }  
     rsIterator.closeRowSetIterator();  Thanks
Example in #1 affect [change] current row in viewobject while example in #2 doesn't affect [change] current row in view object and you can make multiple RowSetIterator for the same viewobject
ReplyDeletersIterator.reset();
ReplyDeleteلا حاجة لاستخدامها في الكود الثاني
وهناك حاجة لها في الكود الأول
كونك لا تضمن موقع الـ iterator
تحياتي
thanks for the samples
ReplyDelete