Hi folks,

in our application we run a db job manually, by submitting a button. Job duration takes a while (1-2 minutes), and during this time an application "feels like frozen/running".

To inform a user about that job is still running I have created a new simple dialog with text "In Progress", which I want to display before a job is submitted, and close once job is done. Unfortunately, an application still first "hangs" and once a database job is finished a dialog displayed. I tried to set a focus at the beginning, but no success. Any suggestions?

Thanks, Tomas

inProgressDialog

<dialog title="Job in progress, please wait ..." width="500" height="430" resizable="N" close="N" >
  <borderLayout >
    <cell docking="Center">
        <include panelName="inProgress"/>
    </cell>
  </borderLayout>
</dialog>

inProgressPanel

<panel preferredHeightPolicy="Dynamic">
  <tableLayout cellSpacing="15">
    <row heightPolicy="Dynamic">
      <cell hAlign="Full" vAlign="Full" childWidth="400" childHeight="300" >
        <image url="/resources/ag_files/WorkInProgress.gif"  />
      </cell>
    </row> 
    <row heightPolicy="Dynamic">
      <cell hAlign="Full" vAlign="Full">
        <textLabel name="lblText" label="Job in progress, please wait ..." text-align="Center" font-size="14" />
      </cell>
    </row>
    <row heightPolicy="Dynamic">
      <cell hAlign="Center" vAlign="Full">
        <button name="btnClose" enable="N" label="Zatvor"   icon="/resources/icons/cancel.png">
          <events>
            <buttonPress action="inProgressClose"/>
          </events>
        </button>  
        </cell>
    </row>
  </tableLayout>
</panel>

In progress package procedure:

procedure organizaceSyncHelios is
  begin
    api_dialog.setvisible('inProgressDialog', 'Y');
    api_dialog.requestFocus('inProgressDialog');

    --sys.dbms_lock.sleep(10);    
    -- spusti job pre aktualizaciu
    dbms_scheduler.run_job('DEV.HELIOS_SYNC_ORG_JOB', TRUE);
    api_sys.executeQuery('ORGANIZACE1');
    api_component.setLabel('inProgress.lblText','Done!');
    api_component.setEnable('inProgress.btnClose','Y');
  end;

asked 13 Jan '14, 09:41

Tomeo's gravatar image

Tomeo
162249
accept rate: 3%


Hi Tomas,

Your code behaves exactly how it should. So there are no bugs or anything like that in Formspider.

Here is the order of things happening and it's different than the order of things you assumed when writing the code above.

  1. User presses the button which executes organizeSncHelios
  2. Procedure organize SyncHelios is executed.
  3. Formspider send a response back to the client which includes actions to be processed on the client side. Specifically: a) set inProgressDialog.visible to Y b) set focus to inProgressDialog c) set Label inProgress.lblText to Done! d) set button inProgress.btnClose enable to Y Remember, Formspider code executes in the Database first and then the client UI is synced to the state updated in the server.

What you want to do should be possible in Formspider.

I think here are the steps you need to follow:

In procedure organizaceSyncHelios:

procedure organizaceSyncHelios is
begin
  api_dialog.setvisible('inProgressDialog', 'Y');
  dbms_scheduler.run_job('DEV.HELIOS_SYNC_ORG_JOB', FALSE);(*)
  /*TO DO*/
   Create a Timer that polls the server every 5-10 seconds 
   to find out if the job is finished.
  /*TO DO*/
end;

(*) The goal here is to run the job parallel so that Formspider can continue processing. I've never used the dbms_scheduler package but I think the code above achieves parallel execution.

The code that the timer executes when it polls the server should check if the job is completed and hide the dialog when the job is finished and stop the timer as well.

Hope this helps.

Kind Regards,
Yalim

link

answered 14 Jan '14, 05:00

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

edited 14 Jan '14, 05:02

Hi Yalim,

yes, this makes sense, and that's what I'm trying to do. I'll test a dbms_scheduler - for a PARALLEL run.

Tomas

link

answered 14 Jan '14, 08:12

Tomeo's gravatar image

Tomeo
162249
accept rate: 3%

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:

×8

Asked: 13 Jan '14, 09:41

Seen: 984 times

Last updated: 14 Jan '14, 08:12


© Copyright Gerger 2017