3 Replies Latest reply: Oct 8, 2013 8:50 AM by JulesO RSS

    APEX_COLLECTION.UPDATE_MEMBER not Working

    JulesO

      Hi.

      I hope someone can help on this matter.

      I have been working with Apex for some time on and off and I and have accomplished more complicated stuff then this.

      Bit this has stopped me in my tracks for 2 days now.

      To the point.

      Onload I create a collection from where I populate a small classical report with a edit link redirecting to a URL(little javascript).

      All this does is show a hidden html region with a few text fields and populates it with the values from the selected row from the report.

      This is then edited and saved, but NOT submitted.

      The save button once again, redirects to a URL(Another small javascript) that passes the values to an On Demand Application process.

      Up to this point everything works fine.

      The process is executed and by different tests I know the values are being received.

      What is suppose to happen is the HTML region gets hidden again and the report refreshed from the collection again.

      That work perfectly BUT.

      For some reason, the APEX_COLLECTION.UPDATE_MEMBER just won't work and I have used this many times before.

      It also DOES NOT PRODUCE ANY ERROR.

      I subsequently broke the application in to a small test but it still won't work.

       

      The code follows.

       

      ---------------------------- THE CREATION OF THE COLLECTION ON PAGE LOAD ----------------------------

       

      DECLARE

       

        l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;

       

      BEGIN

       

        l_collection_name := 'TEST1';

       

        IF apex_collection.collection_exists(l_collection_name) THEN
          apex_collection.delete_collection(p_collection_name => l_collection_name);
        END IF;

       

        APEX_COLLECTION.CREATE_COLLECTION(p_collection_name => l_collection_name);

       

        FOR i IN (SELECT t_uid,  --c001 => f01
                         t_name,  --c002 => f02
                         t_name2,  --c003 => f03
                         'O' sts,  --c047 (for record status)
                         wwv_flow_item.md5(t_uid,
                                           t_name,
                                           t_name2) md  --c048 (for optimistic locking)
                          --c049 for (not used in collection/reserevered for seq_id array)
                          --c050 (not used in collection/reservered for delete checkbox array)
                  FROM   t_test)
        LOOP
          APEX_COLLECTION.ADD_MEMBER(p_collection_name => l_collection_name,
                                                                 p_c001            => i.t_uid,
                                                                 p_c002            => i.t_name,
                                                                 p_c003            => i.t_name2,
                                                                 p_c047            => i.sts,
                                                                 p_c048            => i.md);
        END LOOP;
      END;

       

      ---------------------------- JAVASCRIPT THAT SHOWS AND POPULATES THE HTML REGION  ----------------------------

       

      function popTest(tUid,tname,tName2,tSeq){
      $x_Show('T_DETAILS');
      $s("P5_T_UID",tUid);
      $s("P5_T_NAME",tname);
      $s("P5_T_NAME2",tName2);
      $s("P5_SEQ",tSeq);
      }
      </script>

       

      ---------------------------- JAVASCRIPT THAT EXECUTES THE ON DEMAND PROCESS - HIDES THE HTML REGION - REFRESHES THE REPORT  ----------------------------

      function testJtoSQL(){
        var oDBGet = new htmldb_Get(null, $v('pFlowId'), "APPLICATION_PROCESS=MY_TEST", $v('pFlowStepId'));
        oDBGet.addParam('x01', $v('P5_SEQ'));
        oDBGet.addParam('x02', $v('P5_T_UID'));
        oDBGet.addParam('x03', $v('P5_T_NAME'));
        oDBGet.addParam('x04', $v('P5_T_NAME2'));
        var ajaxResult = oDBGet.get();
        $x_Hide('T_DETAILS');
        $("T_LIST").trigger("apexrefresh");
      };

      ---------------------------- THE ON DEMAND PROCESS ----------------------------

      DECLARE

         l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;

      BEGIN

        l_collection_name := 'TEST1'

         -- This does not work --

         APEX_COLLECTION.UPDATE_MEMBER (

              p_collection_name => l_collection_name,

              p_seq => apex_application.g_x01,

              p_c001 => apex_application.g_x02,

              p_c002 => apex_application.g_x03,

              p_c003 => apex_application.g_x04);

       

        commit;

      END;

       

      I know there will be questions as to why I am doing it this way without submitting the page, so all I will say is that this is just part of a much bigger page with a lot more values to be set before submitting, validation, and processing.

       

      I really hope someone can help

       

      JJ

        • 1. Re: APEX_COLLECTION.UPDATE_MEMBER not Working
          peter_raganitsch

          Hi,

           

          did you make sure that the UPDATE_MEMBER procedure in your on-demand-process is executed? Please use APEX_DEBUG to verify that and also the values you are passing in.

           

          Peter

          • 2. Re: APEX_COLLECTION.UPDATE_MEMBER not Working
            JulesO

            Hi Peter.

             

            Firstly, thank you for your response.

            I have used APEX_DEBUG, with no results.

            To check if my values, I have changed the on demand process to actually update the table and not the UPDATE_MEMBER part,

             

            DECLARE

               l_collection_name APEX_COLLECTIONS.COLLECTION_NAME%TYPE;

            BEGIN

            /*  l_collection_name := 'TEST1'

                APEX_COLLECTION.UPDATE_MEMBER (

                    p_collection_name => l_collection_name,

                    p_seq => apex_application.g_x01,

                    p_c001 => apex_application.g_x02,

                    p_c002 => apex_application.g_x03,

                    p_c003 => apex_application.g_x04);*/

              update t_test set t_name2 = apex_application.g_x01 || ' - ' || apex_application.g_x02 || ' - ' || apex_application.g_x03 || ' - ' || apex_application.g_x04;

             

              commit;

            END;

             

            It updates the table fine and I get my concatenated string in my second string column when checking the database.

            I went through it again and again.

            The APEX_COLLECTION.UPDATE_MEMBER call looks ok to me.

            Maybe I have been staring at it to long, but unless I am missing something, I really don't see anything wrong.

             

            ?????

             

            Any ideas?

            • 3. Re: APEX_COLLECTION.UPDATE_MEMBER not Working
              JulesO

              Hi All

               

              Has anybody got any idea what the problem could be here?

               

              JJ.