Search this blog

PL/SQL Tutorial - What is PL/SQL, Features and Advantages of PL/SQL

PL/SQL is developed by Oracle Corporation to increase/enhance capabilities of SQL, PL/SQL stands for P rocedural L anguage extension to SQ...

Monday, 26 November 2012

Most Used Codes in ADF (Iterate over ViewObject, get Value from pageFlow Scope variable)

Iterate Over View Object-

Some times we need to iterate in table to check for some validation as we have  to check for duplicate record, we want to delete all data of table with one click.
then we have to get all rows of table- this is a very common use case in ADF, so you can use following snippet of code to do this

1. Using AllRowInRange method to get rows available in range

  ViewObject vo=am.getViewObject();

   // Get All Rows in range of ViewObject in an Array
    Row[] rArray=vo.getAllRowsInRange();
    //Loop over array of Rows
    for(Row r:rArray){

       /*your operation code*/


2. Using RowSetIterator-

  ViewObject vo = this.getViewObject();
       //Create RowSetIterator
        RowSetIterator rsi = vo.createRowSetIterator(null);
       //Iterate Over this to get all rows
        while (rsi.hasNext()) {
            Row nextRow =;

Get Value from taskFlow parameter(Using pageFlow Scope)-

we can get value from TaskFlow parameter using pageflow scope and can use it in Our Bean.
Suppose we have defined a parameter in page to pass Session_Id.
We can get it using pageflow scope

Integer sessionId = Integer.parseInt(resolvEl("#{pageFlowScope.Session_Id}"));

 Code For resolvEl-

    public String resolvEl(String data) {
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp = elFactory.createValueExpression(elContext, data, Object.class);
        String Message = valueExp.getValue(elContext).toString();
        return Message;


  1. Ashsish, the first method using the AllRowInRange should not be used. Think about what happens if the table has >100000 rows!


    1. Hi Timo

      Thanks for pointing , Can we use this for less number of rows ?