A Progress Bar for the REN Window June 25, 2008
Posted by Duncan in Application Engine, PeopleSoft, PeopleTools.trackback
When I spoke before about the REN Server window and inserting into it, I mentioned that as well as text a progress bar was a possible inclusion.
The benefit of a progress bar to the users is that they can tell at a glance how far through a long running process is.
There are inherant problems with progress bars of course, in that they’re often less than 100% accurate. Most people have at some point joked at the time estimates for file copy progress bars within Windows, and ‘Microsoft Minutes’ is sometimes used as an ananlogy for inaccurate and super-cautious time estimates.
Despite this, I believe they have a place. For some processes – particularly those that run row-by-row – it’d be pretty easy to work out how far through it is by comparing the row number to the total number of rows.
Here’s how it’s done …
You can output a rudimentary progress bar by using an HTML table with a single row, and many columns. Leave the cells empty but set the background colour differently for the cells representing the completed portion to those representing the incomplete area.
The code could look as follows (HTML formatted over more than one line for legibility):
&strl_progbar = "
<table width='300' cellspacing='3' cellpadding='0' border='0' height='20'>
<tr>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#AAFFAA""></td>
<td BGCOLOR=""#FFAAD4""></td>
<td BGCOLOR=""#FFAAD4""></td>
<td BGCOLOR=""#FFAAD4""></td>
</tr>
</table>";
&nret = &api.notifyToWindow(AEPORTALCSS_AET.PROCESS_INSTANCE, &strl_progbar);
As you can probably see, this would produce a table with 7 green cells (the done proportion) and 3 red (the remaining work), and would look something like this:
The HTML may look a little clunky, but it’s to work around a couple of limitations. For instance if you try to pass a percentage sign through to the HTML it gets stripped out.
Once this is up and working it’d be preferable to wrap this up in a short function rather than have the HTML long hand each time.
Comments
Sorry comments are closed for this entry
What HTML page should be edited for this?
The code goes in the App Engine PeopleCode. No HTML object is altered.
You might want to write a quick function elsewhere to which you can pass the ‘proportion of the job complete’ and it’ll return the HTML, but the above will work also.