0
votes

Env: Oracle APEX v5.1.2 with Oracle 12c R2 DB

I have a report that is based off the following table columns in a table called MY_TASK:

TASK_ID (PK),
TASK,
TASK_STATUS (from TASK_CHECKER.task_status)

I also have another table that I use as a running table to check the status of a job that relates to the TASK_ID number from table MY_TASK called TASK_CHECKER which has the columns:

TASK_ID (PK),
TASK_STATUS

Based on the above, I have a scheduled job that regularly checks the status of another table for a specific TASK_ID, which updates the TASK_STATUS value within the TASK_CHECKER table.

Using the above, when the user runs the Oracle APEX app and goes to the MY_TASK report page, I would like through the use of apex.server.process, at startup, join the two tables together via TASK_ID and display the TASK_STATUS at the time within the MY_TASK report.

Please note that the TASK_STATUS values are: WAITING / IN-PROGRESS / SUCCESS or FAILED

So if I had 5 TASK_IDs running, I might see at page load:

1    TASK_A   SUCCESS
2    TASK_B   ERROR
3    TASK_C   IN-PROGRESS
4    TASK_D   WAITING
5    TASK_E   WAITING

and perhaps 10 seconds later change to:

1    TASK_A   SUCCESS
2    TASK_B   ERROR
3    TASK_C   SUCCESS
4    TASK_D   SUCCESS
5    TASK_E   IN-PROGRESS

Would like to see TASK_STATUS updates appear in real time.

1
The easiest thing to do is to just refresh the region every N seconds. Would that work? - Dan McGhan
@DanMcGhan - Hi Dan, that would work but just wondering whether I could use apex.server.process and refreshing an Interactive Grid does seem to work using apex.region("region_static_id").refresh() . I'm just after a means of refreshing the IG every N seconds without locking the screen, while the user is on the page. - tonyf

1 Answers

0
votes

I just checked and it seems that refresh is async (it doesn't lock the screen). You should be able to do something like this...

setInterval(function() {
  apex.region("region_static_id").refresh();
}, 5000);

Just make sure the number of milliseconds is higher than the amount of time the region takes the query to run and the region to render.