4 Replies Latest reply: Jul 29, 2013 1:55 PM by 945698 RSS

    Display empty table

    945698

      Hello there

       

      -JDeveloper 11.1.2.4

       

      -Train in a bounded task flow with page fragments for the views/train stops

       

       

      I gather information in each train stop that I want to display in the last page fragment, which includes a table, which in turn (following "Displaying an empty table !" example) I want to display with only the selected rows by the user in the previous train stops (the table has already data that I don't want to show). In the method call activity I use the executeEmptyRowSet() on the correspondent VO and then I add only the information of the selected rows (that belong by the way to different VO's). That works well the first time, but when the user goes back to a previous train stop and then returns to the summary page, although the method executeEmptyRowSet() is executed, the VO display the last inserted rows and the new ones.

       

      Here is the AM method exposed:

       

      public void copyCursosProgEsp ()
      {
          //getEstudianteCursos1().closeRowSet();
          ViewObjectImpl estudiantesCursosVO = getEstudianteCursos1();
        
        
          estudiantesCursosVO.executeEmptyRowSet(); 
          estudiantesCursosVO.getEstimatedRowCount();
          String matricula=getBuscaEstudiante2().first().getAttribute("Matricula").toString();
          //create a second row set for the vo to not impact the row set
          RowSet duplicateRowSet = getCursosPeriodoVOExPrgEsp1().createRowSet("duplicateRowSet");
          //set rowset to first row to avoid "attempt to access dead row" exception
          duplicateRowSet.first();
          //get all rows that have the transient attribute "Marcado" set to true
          Row[] selectedRows = duplicateRowSet.getFilteredRows("Marcado", true);
          if (selectedRows.length>0)
          {
            
              for(Row rw : selectedRows)
              {
                  Row newRow = estudiantesCursosVO.getRowSetIterator().createRow();
                  newRow.setAttribute("Matricula", matricula);
                  newRow.setAttribute("Periodo", rw.getAttribute("Periodo"));
                  newRow.setAttribute("ClaveCurso", rw.getAttribute("ClaveCurso"));
                  //estudiantesCursosVO.insertRow(newRow);
                  estudiantesCursosVO.getRowSetIterator().insertRow(newRow);
              }
          }
          duplicateRowSet.closeRowSet();
        
      }

      In summary: I want to display only the newly created rows in the last train stop with the info gathered in the previous train stops. How can I achieve this?

       

      Thanks in advance.

       

      jleon

        • 1. Re: Display empty table
          LindaInci

          If you don't want to fetch any rows from the database with your VO you can make it an "insert only VO". In the "Tuning" section in the VO definition in the block "Retrieve from the Database" choose "No Rows".

          Hope this helps.

           

          Regards,

          Linda

          • 2. Re: Display empty table
            945698

            Thanks a lot Linda,

            I tried your suggestion. It works. It looks cleaner. I would like to empty the table every time the page fragment loads, so I can programmatically  add only the data selected by the user in the previous train stops. If I iterate through this VO trying to delete the rows, all the rows from the correspondent DB table are deleted, not only the newly added. It would be like executing a rollback only on this particular VO.

            Thanks in advance

             

            jleon

            • 3. Re: Display empty table
              LindaInci

              Hi jleon,

              call executeEmptyRowSet() on the View Object. This should empty it.

               

              Regards,

              Linda

              • 4. Re: Display empty table
                945698

                Thanks Linda for taking the time.

                 

                For some reason executeEmptyRowSet() seems not to work. What I did was to iterate through the VO rows and call row.refresh(Row.REFRESH_REMOVE_NEW_ROWS) as someone suggested in "Rollback" changes from a single View Object before inserting the new rows.

                Thanks again

                 

                jleon