9 Replies Latest reply: Mar 25, 2014 3:46 PM by jariola RSS

    running ondemand process

    Gor_Mahia

      All,

       

      i created on demand process which calls a procedure as below,

       

      CALL_PROCESS1

      ==============

      begin

      procedure1(pid=>133);  // for now test simple insert into statement within this procedure

      end;


      then, jscript to call the process at page header(Function and Global Variable Declaration)

       

      function myAjaxProcess() {
      var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CALL_PROCESS1',$v('pFlowStepId'));
      //invoke it now
      gReturn = get.get();
      // you can alert the ajax call back
      //alert(gReturn);
      }

       

      then run it under - Execute when Page Loads

       

      like myAjaxProcess();

       

      but its not working and no error can somebody please help me on this?

       

      Apex 4.2

       

      thanks.

        • 1. Re: running ondemand process
          jariola

          Gor_Mahia wrote:

           

           

          All,

           

           

           

           

           

          i created on demand process which calls a procedure as below,

           

           

           

           

          CALL_PROCESS1

           

          ==============

           

          begin

           

          procedure1(pid=>133);

           

          end;

           

           


           

           

          then, jscript to call the process at page header(


          Function and Global Variable Declaration

           

           

           

           

           

           

           

           

          function myAjaxProcess() {
          var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CALL_PROCESS1',$v('pFlowStepId'));
          //invoke it now
          gReturn = get.get();
          // you can alert the ajax call back
          //alert(gReturn);
          }

           

           

          Hi,

           

          What is actual question?

          APEX version?

           

          Regards,

          Jari

          • 2. Re: running ondemand process
            Gor_Mahia

            Hi Jari,

             

            I just updated my question...thank you.

            • 3. Re: running ondemand process
              jariola

              Gor_Mahia wrote:

              but its not working and no error can somebody please help me on this?

              Hi,

               

              That is always good description of problem.

              What that peace of code should do ?

              We do not know anything about your procedure procedure1


              Don't use htmld_Get function witch is not documented

              Instead of that use apex.server.process

               

              E.g this might help to debug problem

              How to test an On-Demand Process used for AJAX | Inside Oracle APEX by Patrick Wolf

               

              Regards,

              Jari

              • 4. Re: running ondemand process
                Gor_Mahia

                Jari,

                 

                For now lets just consider a small process like below, my ondemand has only simple insert line

                CALL_PROCESS1

                ==============

                 

                begin

                 

                insert into test111 values(133);

                --procedure1(pid=>133);

                 

                end;

                 

                Also you didnt recommend htmld_Get function which ive used in many other places also i see other people use it well i really dont understand why this call doesnt wotk but if i set the alert below its showing but not INSERT statement,

                 

                 

                function myAjaxProcess() {

                var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CALL_PROCESS1',$v('pFlowStepId'));

                //invoke it now

                gReturn = get.get();

                // you can alert the ajax call back

                alert(gReturn); 

                }

                 

                 

                Any idea is appreciated...thanks.

                • 5. Re: running ondemand process
                  jariola

                  Hi,

                   

                  Yes, there is lot of examples to use htmldb_Get. But that function is not documented or supported.

                  I did not say it will not work, at least for now. But if you are on APEX 4.2, you should use apex.server.process witch is supported and documented.

                   

                  If you like get your JavaScript alert On Demand process result try

                  begin
                  insert into test111 values(133);
                  htp.prn(SQL%ROWCOUNT || ' row inserted');
                  Exception when others then
                  htp.prn(sqlerrm);
                  end;
                  

                   

                  BTW, what triggers call to your JavaScript function myAjaxProcess ?

                   

                  Example in apex.oracle.com is always best way demonstrate problem.

                   

                  Regards,

                  Jari

                  • 6. Re: running ondemand process
                    Gor_Mahia

                    Jari,

                     

                    For the call to js function i tried also a button click by setting its target url ==> javacsript:myAjaxProcess(); i think this part is ok,

                     

                    its weird why it doesnt work,

                     

                    function myAjaxProcess() {

                    var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CALL_PROCESS1',$v('pFlowStepId'));

                    //invoke it now

                    gReturn = get.get();

                    // you can alert the ajax call back

                    //alert(gReturn);

                    }


                    thank you.

                    • 7. Re: running ondemand process
                      jariola

                      Gor_Mahia wrote:

                       

                      Jari,

                       

                      For the call to js function i tried also a button click by setting its target url ==> javacsript:myAjaxProcess(); i think this part is ok,

                       

                      its weird why it doesnt work,

                       

                      function myAjaxProcess() {

                      var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=CALL_PROCESS1',$v('pFlowStepId'));

                      //invoke it now

                      gReturn = get.get();

                      // you can alert the ajax call back

                      //alert(gReturn);

                      }


                      thank you.

                      Hi,

                       

                      Yes, indeed.

                      Whit given information it is impossible help

                       

                      Regards,

                      Jari

                      • 8. Re: running ondemand process
                        Gor_Mahia

                        Jari,

                        Sorry iam not clear on this so I created a sample as stated below can you please login in and see my problem,

                         

                        Application 79390

                        RUN PAGE 41 and clicking button will execute ondemand process then call the report page but the ondemand proc isnt doing the insert,

                         

                        sample:

                        ================

                         

                        http://apex.oracle.com/pls/apex

                        workspace=proj2010

                        user/pswd= demo123/demo123,

                         

                        thanks for your time.

                        • 9. Re: running ondemand process
                          jariola

                          Hi,

                           

                          Could you please explain what you try archive?

                          Example code do not look at all what you have previously post.

                           

                          Why you attach onclick event listener to button in page HTML header?

                          And use button target # ?

                          That all could be done more simple and APEX native way using dynamic action.

                           

                          I did modify bit your example.

                          Now it at least "works", if we count that On Demand process do not give errors anymore.

                           

                          Regards,

                          Jari