2 Replies Latest reply: Jun 14, 2013 8:39 AM by NancyK_1 RSS

    APEX Interactive Report that only runs OnClick

    NancyK_1
      I want to create an interactive report in APEX that will only run an SQL statement after parameters are entered and a button is clicked. The problem I have encountered is that if I create an interactive report region, the sql gets executed when the page opens, as well as when the button is click. Since I am a Nubbie to APEX, I am not clear on how to go about it.

      Edited by: 1010000 on Jun 5, 2013 12:55 PM
        • 1. Re: APEX Interactive Report that only runs OnClick
          Diviya
          Hi,


          Welcome, Please change your handle name to a more friendly user name.

          And Yes, It can be done by the following steps.


          -Create a hidden item. (eg: 'P10_RUN')

          -In your HTML Header of 'Edit Page' , give a javascript function to assign value to the hidden item.

          <script language="JavaScript" type="text/javascript">
          
          function f_run() {
          $s('P10_RUN',1);       //Assigns the value 1 to P10_RUN item
          doSubmit('RUN_REPORT');
          }
          </script>
          -Create a 'Run' button with action as 'Redirect to URL' and in the url target give
          javascript: f_run();
          Now in your interactive report,give the required condition
          Conditions
          Condition Type: PL/SQL Expression and in the text field :P10_RUN=1


          When you click the Run button, the hidden item value is set to 1. And Your interactive report will be shown.

          Make custom changes according to your requirement.


          -Divya

          Mark the thread as answered if your question is Answered.
          • 2. Re: APEX Interactive Report that only runs OnClick
            NancyK_1

            Hi Divya,

            Thanks for you answer.  Although it works to keep the report from running when the page initially loads, the value of the hidden field appears to reset itself everytime the page is submitted.  As a result, the report does not display after the OnClick event is triggered..

             

            -Nancy