This discussion is archived
1 2 Previous Next 16 Replies Latest reply: Apr 7, 2011 8:08 AM by 832887 RSS

Automaticaly refresh a Classic Report

832887 Newbie
Currently Being Moderated
Anyone can help me with this?

How to automaticaly refresh a classic report

Tanks
  • 1. Re: Automaticaly refresh a Classic Report
    Maheswara Explorer
    Currently Being Moderated
    Hi Macwadu,

    If you want to refresh the classic report on particular intervals you can do it by using javascript setTimeout function.
    Otherwise if you want to refresh the report on the data updation in the table then you have to use the AJAX call.

    Thanks and Regards
    Maheswara
  • 2. Re: Automaticaly refresh a Classic Report
    691822 Newbie
    Currently Being Moderated
    Could you explain please how to use Ajax call to refresh reports on data update?

    thanks
  • 3. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    But using javascript it reloads all the page and not only de classic report.

    I used this code to trie with javascript
    <script type="text/JavaScript">
        function refresh_this_page(timer_in_seconds) {
            setTimeout("location.reload(true);",timer_in_seconds*1000);
        }
    window.onload = refresh_this_page(20);
    </script>
  • 4. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    <li>The code used in the onload(execute on load or jQuery ready) function would be
    In apex 4,
    var refreshId = setInterval(function()
    {
        $('#REGION_STATIC_ID').trigger('apexrefresh');
    }, 4000);
    +refreshes report after 4 seconds)

    <li>in previous versions , you need to use the *$a_report* function to refresh the report instead of triggering the 'apexrefresh' event
    var refreshId = setInterval(function()
    {
    $a_report('REPORT ID' , '1', '15)
    }, 4000);

    do a search for the function *$a_report* here in the forum or google and you should be able to find a lot of examples.
  • 5. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    When you say "The code used in the onload(execute on load or jQuery ready) function" this is a process we have to create?

    and if is a JQuery is to put in header of the classic report?
  • 6. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    I meant the JS code used within the function that you had used, i.e inside refresh_this_page() function
  • 7. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    Sorry for complicating thing, but i think i'm not doing the things right.

    I'm putting this on the header of the page but it isnt working. The
    P4_LIST
    is the static id of classic report.

    <script type="text/JavaScript">    
    function refresh_this_page(timer_in_seconds) {        
         
          var refreshId = setInterval(function(){    
            $('#P4_LIST').trigger('apexrefresh');
          }, timer_in_seconds*1000);
        
    }
    window.onload = refresh_this_page(10);
    </script>
    what i'm doing wrong?


    Tanks
  • 8. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    Are you on apex 4.0 ?
    then just add the following to the "*execute when page loads section*" of the page (or a Dynamic Action that fires on page load)
          var refreshId = setInterval(function(){    
            $('#P4_LIST').trigger('apexrefresh');
          }, timer_in_seconds*1000);
  • 9. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    Yes is apex 4

    I have found my problem but i dont know how to solve it.

    When i create in execute when page loads section or the dynamic action it works fine but i have the function to create a modalform with ajax in page header and when i put that code in the dinamic action or in page loads it stops working.


    Anyone knows why?

    Edited by: macwadu on 05-Apr-2011 04:19
  • 10. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    It could happen when you have some syntax error in the JS cdoe which breaks other JS components too.
    but i have the function to create a modalform with ajax in page header and when i put that code in the dinamic action or in page loads it stops working.
    Are you trying to move the function definition to the Dynamic Action or is this just a call to the function defined elsewhere ?

    When some code within a JS block throws an error it stops executing the rest of the lines(unless you handle these exceptions manually). So mayb the function which gets called throws some error, it doesn't run the "auto-refresh" code.
  • 11. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    ok, it works i dont know if is the best programing but i used a try cath in exception i put the code to execute the refresh :)
  • 12. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    why don't you try and identify the problematic line and fix it there , instead of wrapping code within try-catch block ?
  • 13. Re: Automaticaly refresh a Classic Report
    832887 Newbie
    Currently Being Moderated
    My mistake works the refresh but doesn't work the modelform.


    How can i know where is the error, with firebug?
  • 14. Re: Automaticaly refresh a Classic Report
    vee Guru
    Currently Being Moderated
    Yes, open the firebug console panel and reload the page. You should see the error messages displayed in the console log.
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points