4 Replies Latest reply on Jul 22, 2013 6:17 PM by MattDBperson

    Show Chart on Page Load

    MattDBperson

      I have some charts based on queries that show data with a WHERE clause of

       

      WHERE date BETWEEN P#_START_DATE AND P#_END_DATE

       

      My problem is the charts don't load when the page loads.  It only shows "No data found."  The dates, though, are preloaded based on the system date (+/- 30) and can of course be changed by the user.  How do I get the charts to execute on the page immediately on loading using the parameters instead of the user having to hit the "GO" button.  Most users don't read the instructions on the page and instead just come back and tell me my queries are broken.

       

      It is ok if they have to hit "GO" after changing the date, but I want the initial default load to show without them having to do that.

       

      Thanks.

        • 1. Re: Show Chart on Page Load
          Joe Upshaw

          I think your page items for start date and end date are not getting set like you think they are. Run the page from the development environment and, without changing anything, click the session link and see if they are set. I think your chart is running but, these are actually set to NULL.

           

          To set them, create a Before Header computation for each of them to set them to SYSDATE and (SYSDATE + 30).

           

          -Joe

          • 2. Re: Show Chart on Page Load
            MattDBperson

            Thanks for the quick response.  I'm an APEX newbie, though, so could you give me some hints on how to set the page items in the before header?  The session page does indeeded show them as NULL before I hit go on page load and with values thereafter.

            • 3. Re: Show Chart on Page Load
              Joe Upshaw

              When you're in the editor, at the top of the page, you wee a section labeled Before Header. Expand this.

               

              Inside, you see several options one of which is Computations. Right-click on this, and select Create. Choose your page item that is being set. Choose PL/SQL Function Body as the type. Here, enter:

               

              BEGIN

              RETURN SYSDATE;

              END;

               

              -Joe

              • 4. Re: Show Chart on Page Load
                MattDBperson

                That did it, thanks.

                 

                Edit: I had to put it under new instance instead of before header to be able to change the date, but that was what I needed.

                Matt