One of my favorite mottoes is "do not reinvent the wheel" and this posting shows you how to "recycle" a standard Apex component like a flash chart to display a nicely integrated and animated progress bar, a widget that may come in handy for "entertaining" users during certain long-lasting operations.
So, instead of creating something from scratch, i prefer to re-use an existing and supported component of Apex to achieve the same result, which complies with my initial statement.
The need for a progress bar arose while developing a new page for the recently released DBMS_PROFILER companion application, where i let the user import data from a remote db and owing to the duration of the operation, i wanted to show the current status of the operation occurring in background.
Let me summarize the basic requirements for a successful and meaningful implementation of this widget in your application:
- the operation must take several seconds, otherwise why bother?
- the process must be executable in background;
- user must have the flash player installed but this should not be a problem nowadays.
- you must be using Apex 3.1 or newer.
In order to make the progress bar indicator work in your application, you will need to perform the following actions:
- decide whether you want to display the progress bar inside a region of the same page where you execute the process or in a different page;
- copy the flash chart region to the desired place;
- change the display condition to suit your needs;
- create an after submit process that submits your procedure as a background job (an example is provided);
- create a page validation based on the code supplied in the demo application (an example is provided);
- modify the "core" procedure to make use of the YY_UPD_PROGRESS_BAR procedure (sample procedure YY_TEST_PROGRESS_BAR is provided).
- adjust the chart parameters or XML source code to fine tune the progress bar indicator look (optional).
See more articles about Oracle Application Express or download tools and utilities.