This content has been marked as final. Show 1 reply
Client (your browser) need check status from server.
Here is one example that might help
When you press "Submit Job" button page is submitted and process creates job using APEX_PLSQL_JOB.
Then window is refresh every 10 sec, until job finish.
I did create application item G_META_TAG
I did place to page HTML header
Then I did create display only item Px_JOB_RUNNING and Px_JOB_ID
Computation "PL/SQL Function body" for Px_JOB_RUNNING
Computation "PL/SQL Function body" for G_META_TAG
FOR c1 IN( SELECT 1 FROM apex_plsql_jobs WHERE (job = :Px_JOB_ID OR :Px_JOB_ID IS NULL) AND system_status = 'COMPLETE' )LOOP RETURN 'No'; END LOOP; RETURN 'Yes';
Then submit button conditionally Px_JOB_RUNNING value "No".
IF :Px_JOB_RUNNING = 'Yes' THEN RETURN '<meta http-equiv="refresh" content="10">'; ELSE RETURN NULL; END IF;
Page after submit process
I did make process conditionally by submit button and Px_JOB_RUNNING value "No"
DECLARE l_sql VARCHAR2(4000); l_job NUMBER; BEGIN l_sql := ' BEGIN FOR i IN 1..3 LOOP APEX_UTIL.PAUSE(10); END LOOP; END; '; l_job := APEX_PLSQL_JOB.SUBMIT_PROCESS( p_sql => l_sql, p_status => 'Background process submitted' ); --store l_job for later reference :PX_JOB_ID := l_job; :PX_JOB_RUNNING := 'Yes'; END;
This is not ready solution and probably have bugs.
One thing is specially how you check is job running.
My sample stores job id to item session state. Value is lost if user logout, close browser or clears cache.
Then user can submit job again, even previous job is running.
Anyway I hope it give idea for you how continue.
You can do similar check using Ajax/dynamic actions. Then whole window is not refreshed.
Edited by: jarola on Nov 18, 2010 7:10 PM
Here is sample using Ajax