5 Replies Latest reply: Feb 22, 2013 12:43 PM by raykdogs RSS

    Insert Row Using Data From Another Unrelated Row

    raykdogs
      Jdeveloper 11g.
      I am new to Jdeveloper.
      I have an application that has an adf:table generated from View Object A.
      The application allows a user to press a button and have a popup displayed (using a Task Flow). The popup displays an adf:table generated from View Object B.
      The user is able to select row(s) from the table in the popup and press a button to Save.
      What I need to happen is to use data from the selected rows in the popup to insert rows into ViewObject A.
      There is no relation between View Object A and View Object B. I just need to populate one vo with data from the other.

      The problem I am running across is that View Object B is on a different page than View Object A.
      I have a backing bean that runs the return listener with the value from the return params.
      I figured I could simply use the primary key value from the return param, query the row for View Object B and create a new row for View Object A. However, the only way I know how to do this is to use the iterators, but when I try and get the iterators from my backing bean, they are not found.

      Remember, I am new to this, so be gentle.
      Thank you.
        • 1. Re: Insert Row Using Data From Another Unrelated Row
          raykdogs
          Further Info!
          I am using the AfterListener in adfc-config to attempt to populate the view object.
          The method that runs cannot find any bindings.
          The following returns null:
          BindingContext bc = BindingContext.getCurrent();
          BindingContainer bindings = bc.getCurrentBindingsEntry();
          if (bindings == null){
           System.out.println("Bindings is null");  // this gets called
          }
          Any help would be appreciated.

          Edited by: raykdogs on Feb 22, 2013 6:45 AM

          Edited by: raykdogs on Feb 22, 2013 6:47 AM
          • 2. Re: Insert Row Using Data From Another Unrelated Row
            Frank Nimphius-Oracle
            Hi,

            this is because the iterator of page B is out of scope when you return to the calling page. Have you tried returning a HashMap or ArrayList containing POJO objects with the data for the rows ?

            Frank
            • 3. Re: Insert Row Using Data From Another Unrelated Row
              raykdogs
              What I have done was returned an ArrayList that contains the ids of the database row for ViewObject B.
              When I returned from the task flow, I figured I would just use the iterators from my calling page and get the records that match the ids in the ArrayList but I cannot access those iterators either.
              It still says my bindings are null.
              I am certain I have bindings and iterators on the calling page.
              • 4. Re: Insert Row Using Data From Another Unrelated Row
                raykdogs
                Maybe there is another, easier way to accomplish this. An example scenario may be called for.

                I have 2 View Objects.
                Employees
                EmployeeTemplate

                I have a table on Page A that lists all Employees.
                I have a button that the user can click to add new employees to the table. When the user clicks the button, another table is displayed with the list of Employee Tempates.
                The user can then select multiple templates and click Save. This should add the data from the selected EmployeeTemplate to the Employees table.

                Again, any help would be appreciated.
                • 5. Re: Insert Row Using Data From Another Unrelated Row
                  raykdogs
                  Please advise.

                  Is this a difficult thing to do?
                  I smy question confusing?
                  Is my question not phrased correctly?
                  Is it easy to do but hard to explain?

                  I am at the mercy of this forum. Any help, please.