7 Replies Latest reply: Mar 17, 2013 12:29 PM by Timo Hahn RSS

    How to create an iterator for a table?

    TalyaZ
      Hey
      I know this is a question for begginners- but maybe you could help me

      Im rtying to go over some table rows with an iterator

      I know the function "binding.findIteratorBinding(tablenameIterator)

      but it seems that I should do something more since I get an exeption

      should i define the iterator? and if so- how?


      or if not- does it maybe got something to do with the fact that my data control table is in another data control table? (and if so- how should I writh the whole path?)


      Thank you so muh
      Talya
        • 1. Re: How to create an iterator for a table?
          Puthanampatti
          DCIteratorBinding iterator= ADFUtils.findIterator("VOIterator");
          Row[] rows= iterator.getAllRowsInRange();
          if(rows !=null){
          Row row = iterator.getViewObject().getCurrentRow();
          if (null != row){
          Number id = row.getAttribute("Id");
          • 2. Re: How to create an iterator for a table?
            TalyaZ
            I tried doing that but I dont have the ADFUtils class

            checked for what this method should have contained:
            getDCBindingContainer was also there but I didnt have this helper too

            checked what it should have conatained but this time I got an error too

            do you know from where can I download this ADFUtils from?
            • 3. Re: How to create an iterator for a table?
              Timo Hahn
              User, please tell us your jdev version!

              What error do you get?

              You don't need the ADFUtils class. If you have an iterator defined in your pagedef you can access it
              // Get the data from an ADF tree or table
              DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
              //Get iterator
              DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("testIterator"); //Name of the iterator in your pagedef
              /// get current row and one attribute
              String attribute = (String)iterBind.getCurrentRow().getAttribute("field1");
              
              //to get a navigatable oterator use
               NavigatableRowIterator navIter = iterBind.getNavigatableRowIterator();
              // get next row
              Row row = navIter.next();
              Timo
              • 5. Re: How to create an iterator for a table?
                TalyaZ
                hey
                Timo- how do I define the iterator on pagedef?
                (my version is 11.2.3)

                is this good?
                (cause it still doesnt work)
                <methodIterator Binds="getOrderSummary.result" DataControl="datacontrol" RangeSize="25"
                BeanClass="view.datacontrol.getOrderSummary" id="getOrderSummaryIterator"/>
                <variableIterator id="variables">

                this is my error:

                ]] Root cause of ServletException.
                javax.el.ELException: oracle.jbo.NoDefException: JBO-25058: Definition STATUS of type Attribute is not found in ViewDefview_datacontrol_getOrderSummary1_40.
                     at javax.el.BeanELResolver.setValue(BeanELResolver.java:345)
                     at com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
                     at com.sun.faces.el.DemuxCompositeELResolver.setValue(DemuxCompositeELResolver.java:281)
                     at com.sun.el.parser.AstValue.setValue(Unknown Source)
                     at com.sun.el.ValueExpressionImpl.setValue(Unknown Source)



                my page just turns out blank...


                and for- Puthanampatti      
                after downloading the file how do I add it to the project?

                I wasnt kidding about the begginers's part(=

                Thanks
                • 6. Re: How to create an iterator for a table?
                  Puthanampatti
                  try like this, Status (initcap)

                  create a util package under your source and add this util class
                  • 7. Re: How to create an iterator for a table?
                    Timo Hahn
                    The easiest method to define en iterator is to drag the vo you want fro m the datacontrol onto the page and drop it as table. This will generate the needed itarator. As you don't want the table, you switch the editor into source mode (so that you see the tags like af:table). In this source you can remove the af:table tag completely. This will keep the binding in the pagedef, but remove the table. Don't remove the table in hte design view, as this will delete the binding from the pagedef too.

                    Timo