Hi, after uploading a zipfile, it has to be unzipped resulting in a list of files that have to be processed before the user can check their contents and report on it. Since these are relatively long running operations, I would like to tell the user what is happening, in a regular fashion. This can be anything from showing a log entry for every file that is processed, a 'night-rider' activity indicator (that does not really tell anything), a progress-bar or a status field that is updated for every file.

What methods are available in Formspider to show this progress? FWIW: I thing about using Oracle Scheduler to do the heavy lifting.

asked 20 Feb '13, 03:54

ik_zelf's gravatar image

ik_zelf
58312
accept rate: 16%

Hi Ronald,

Are you aiming to prevent the user interaction with your Formspider application during this process or the users should be able to continue to use your Formspider application during this process? Also, do you have any chance of inserting rows into a db table from the code called by your job (to log the job progress)?

Regards,
Ibrahim

(21 Feb '13, 10:26) Ibrahim Sand... ♦♦

Hi Ibrahim, in the database I can do anything I want. The user will be waiting for a process that can be monitored using v$session_longops, if I code it that way. There is no reason to prevent user interaction, just make the user aware of the fact that 'something' has not yet been completed.

(21 Feb '13, 10:38) ik_zelf

Hi Ronald,

In this case, you can log the job progress into a db table. In your formspider application, create a datasource from this log table (named "LOG1" in the example below). When you run your job, start a Formspider timer (named "jobProgress" in the example below) which regularly queries (with an interval of 10 seconds for example) your log datasource in its timerExpired event. You can bind this log datasource to a Formspider grid to display the progress.

As an example, the procure which runs your job may be as following:

procedure runJob is
  v_job_id number;
  v_jobName_tx varchar2(255);
begin
  -- generate an unique job name
  v_jobName_tx := dbms_scheduler.generate_job_name;
  api_session.add('jobName', v_jobName_tx);
  -- start the timer
  api_timer.starttimer('jobProgress'); 
  -- create and run the job
  dbms_scheduler.create_job(job_name        => v_jobName_tx,
                            job_type        => 'PLSQL_BLOCK',
                            job_action      => 'BEGIN job1; END;',
                            start_date      => sysdate,
                            repeat_interval => null,
                            end_date        => sysdate+1,
                            enabled         => true,
                            auto_drop       => true);
end;

Then, you can call the following procedure on timerExpired event of the "jobProgress" timer:

procedure timerExpired is
  v_isJobRunning_yn varchar2(1);
  v_jobName_tx varchar2(255);
begin
  v_jobName_tx := api_session.getvaluetx('jobName');
  -- if a running job exists
  if v_jobName_tx is not null then
    -- check whether this job is still running or not
    begin
      select 'Y' into v_isJobRunning_yn from dual
      where exists (select 1 
                    from USER_SCHEDULER_RUNNING_JOBS 
                    where job_name = v_jobName_tx
                  );
    exception 
      when no_data_found then
        v_isJobRunning_yn := 'N';
    end;

    -- query job logs from your custom table
    api_datasource.executequery('LOG1');

    -- if the job is completed remove the session variable
    if v_isJobRunning_yn = 'N' then
      api_session.remove('jobName');
    end if;
  end if;
end;

Hope this helps,
Ibrahim

link

answered 23 Feb '13, 06:53

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

thanks, I will experiment with it.

(23 Feb '13, 10:34) ik_zelf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×2
×1
×1

Asked: 20 Feb '13, 03:54

Seen: 850 times

Last updated: 23 Feb '13, 10:34

Related questions


© Copyright Gerger 2017