I’ve seen numerous solutions for partial page refreshes. All using javascript, timers etc.

I just want a report to refresh itself after 5 seconds.

I add this to the region-footer:

<script type="text/javascript">
<!--
setInterval( "$a_report('##REGION_ID#'.substring(1), 1, 7, 7);", 5000);
//-->
</script>

On request of Patrick Wolf (in the remarks below) this also works:

<script type="text/javascript">
<!--
  setInterval("jQuery('##REGION_ID#').trigger('apexrefresh');", 5000);
//-->
</script>

No extra javascript functions, no dificult parameters, works for multiple regions..

Essentially it will do a region refresh using the $a_report apex-javascript function only once (after 5 seconds)..

But when the region gets refreshed…. this region-footer gets executed again…. hence: a refresh every 5 seconds.

$a_report takes these parameters:

  1. the region_id that needs to be refreshed. (apex puts an ‘R’ in front of it. the substring(1) removes the ‘R’ again)
  2. the 1st record to show
  3. the last record to show
  4. the number of records to show
  5. sorting

I hope this helps.

12 thoughts on “Oracle APEX report refresh the easy way

  1. Hi Richard,

    I would suggest to not use undocumented and unsupported APEX Javascript APIs. It’s very likely that we will change them in the future.

    If you are on APEX 4.0 you can use

    jQuery('#STATIC_ID_OF_REGION').trigger('apexrefresh');

    to refresh a region or you just use the “Refresh” dynamic action in combination with the Timer dynamic action plug-in from

    Regards
    Patrick

    Reply
    • @Richard – thanks for the article and apologies for replying to such an old comment!

      @Patrick –
      I’m using Apex 4.2 and have searched through the javascript APIs. It seems that in this version, the way to invoke the above “trigger” method is to call the documented apex.event.trigger function. However, I can’t for the life of me find any hint in the documentation regarding the events themselves (the pEvent parameter to this function, I assume). Is there somewhere that ‘apexrefresh’ is officially described?

      Many thanks,
      Jon.

      Reply
  2. I tried to use the timer plugin.
    It works fine for periodically refresh reports (e.g. select to_char(sysdate,’HH24:MI:SS’) from dual), but I can’t get it working to refresh page items (or regions with page items).
    Any suggestions to get this item refresh working with the timer plugin are welcome.
    Thanks, Frank

    Reply
  3. Frank,

    Hmm.. I don’t see where I’m using a plugin. Maybe you can try Patrick’s suggestion below. Otherwise try to get infromation from the plugin developer.

    Regards,
    Richard

    Reply
  4. Please, how to implement a timer(hh:mi:ss) in oracle apex. I review the documentation but don´t understand, can you say me peer to peer how to do.

    Thanks,
    Wilson

    Reply
  5. Thanks Richard,
    Worked great for me. I was doing whole page refresh, but region refresh is match better. You don’t have a blinking page!
    But instead of region number I placed div tag in header of the region and used it as a selector.
    setInterval(“jQuery(‘#my_dev’).trigger(‘apexrefresh’);”, 5000);

    Best,
    Sofia

    Reply
  6. Pingback: Oracle APEX Report Refresh The Easy Way « OraPedia

  7. NOTE: This only worked for me in the following configuration:

    setInterval(“apex.jQuery(‘##REGION_STATIC_ID#’).trigger(‘apexrefresh’);”, 3000);

    Hope this helps someone else having the same trouble I did. (apex version 4.1.1.00.23)

    Reply
  8. This works, but how do you stop it from taking you to the first page of the report? I would like to refresh but keep the pagination the page is on at the start of the refresh

    Reply

Leave a Reply