6 Replies Latest reply: Feb 26, 2013 8:26 AM by VC RSS

    adding additional rows

    989283
      Having some issues with adding additional rows (more than a single insert) in apex :

      I have a drop down list representing 'quantity', once I have chosen my option I put in the amount of the rows I need (same as the quantity selected) and it only inserts one row.

      I had a look at the option below:

      Put this in the "Execute when Page Loads"
      addRow();
      addRow();
      ...
      (the number of rows you want to add).

      I am not able to find “Execute when Page Loads” on the page.

      then add:

      Please can someone point me in the right direction, let me know if this is possible? THanks
        • 1. Re: adding additional rows
          Denes Kubicek
          This example shows something similar:

          https://apex.oracle.com/pls/apex/f?p=31517:279

          Denes Kubicek
          -------------------------------------------------------------------
          http://deneskubicek.blogspot.com/
          http://www.apress.com/9781430235125
          http://apex.oracle.com/pls/apex/f?p=31517:1
          http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
          -------------------------------------------------------------------
          • 2. Re: adding additional rows
            989283
            Hi Denes,

            I had a looked at your example, but this is not quite what I am looking for.
            I would like to type in any quantity, e.g. 50 in a field and have 50 INSERTs of new rows happen against table instead of 1. Is this possible?

            I believe this SQL statement will do the trick, but I am not sure where it should go

            BEGIN FOR i IN 1..quantity_from_field LOOP
            INSERT INTO inve1 (list,of,columns) VALUES(list, of, values);
            END LOOP; END;

            Thanks in advance.
            • 3. Re: adding additional rows
              VC
              986280 wrote:
              Hi Denes,

              I had a looked at your example, but this is not quite what I am looking for.
              I would like to type in any quantity, e.g. 50 in a field and have 50 INSERTs of new rows happen against table instead of 1. Is this possible?

              I believe this SQL statement will do the trick, but I am not sure where it should go

              BEGIN FOR i IN 1..quantity_from_field LOOP
              INSERT INTO inve1 (list,of,columns) VALUES(list, of, values);
              END LOOP; END;

              Thanks in advance.
              You have to add that into a pl/sql page process which should fire on On-Submit

              How to add a PL/SQL page process
              • 4. Re: adding additional rows
                Joni Vandenberghe
                Hi,

                Go to your page. Right click on the page name in the page rendering section. Click edit. Go to javascript. Scroll down & there you have it.
                • 5. Re: adding additional rows
                  989283
                  I don't want to add rows to the page, I want a value in a text field to do 'n' number of inserts in the DB
                  instead of just one.
                  • 6. Re: adding additional rows
                    VC
                    986280 wrote:
                    I don't want to add rows to the page, I want a value in a text field to do 'n' number of inserts in the DB
                    instead of just one.
                    See my reply above!