2 Replies Latest reply on Jun 13, 2018 10:39 AM by User603097-Oracle

    Query regrarding apex_item.checkbox and APEX_APPLICATION.G_FXX

    User603097-Oracle

      I have an  interactive report based on a backend table, with one column created as checkbox using "apex_item.checkbox", each row thus have a checkbox. Check box is getting created and displayed correctly. Query to cretae checkbox is like this :

      select apex_item.checkbox(1,IS_USEFUL) "SELECT", . . . . .)

       

      I want to update a column in the same backend table for rows in the report which are selected using the checkboxes. For that I have created a process using APEX_APPLICATION.G_F01 as below :

       

      (test2345 is the tablename, IS_USEFUL is the column to be updated, PROB_ID is another column)

       

      BEGINFOR i in 1..APEX_APPLICATION.G_F01.COUNT LOOPUPDATE test12345

      SET IS_USEFUL = 'Y'

      WHERE PROB_ID = APEX_APPLICATION.G_F01(i);END LOOP;COMMIT;END;

       

       

      Infact, the above code is not updating the backend table .

       

      Looking for some help.

       

      Thanks

        • 1. Re: Query regrarding apex_item.checkbox and APEX_APPLICATION.G_FXX
          Pavel_p

          Hello,

          I think the mistake is in your select statement

          select apex_item.checkbox(1,IS_USEFUL)
          

          and in my opinion there should be

          select apex_item.checkbox(1,PROB_ID)...
          

          as you're using it later in the where clause for update. If this does not help, I would suggest to add debug messages into your code like this

          begin
            
            for i in 1 .. apex_application.g_f01.count loop
              
              apex_debug.message('DEBUGMSG: g_f01(%s) = %s', i, apex_application.g_f01(i));
          
              update test12345
                set is_useful = 'Y'
                where prob_id = apex_application.g_f01(i);
            end loop;
            --commit; do not commit, apex itself performs either commit or rollback (if there are any errors)
          end;
          

          run the page in debug mode and then inspect the debug trace to see what's happening under the hood.

          Regards,

          Pavel

          1 person found this helpful
          • 2. Re: Query regrarding apex_item.checkbox and APEX_APPLICATION.G_FXX
            User603097-Oracle

            Thank You Very Much, Pavel.

             

            Your suggestion worked!