Axaptapedia is now maintained by AgileCadence For more information please click here.

Progress Bar

From Axaptapedia
Revision as of 17:43, 2 March 2010 by Anton Venter (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction[edit]

A progress bar is a graphical representation of a job's progress and is used extensively in the standard application. By using a progress bar, users can follow the job's progress. It is best practice to always display a progress bar during a lengthy process.

Progress Bar within a batchable class[edit]

The RunBase framework has methods which will initialize the progress bar so that you can focus on coding the process.

<xpp> // progress bar Runbase demo public void run() {

   str     text;
   int     percent;
   int     counter;
   int64   progressTotal = 200; // hard coded for demo purpose (this is normally calculated)
   ;
   this.progressInit("Processing", progressTotal,  #AviFormLetter);
   progress.setText("Item");
   for (counter = 1; counter <= progressTotal; counter ++)
   {
       //
       // processing happens here
       //
       sleep(10);
       //
       // progress bar text for the current 'item'
       //
       percent = decRound((counter / progressTotal) * 100, 0);
       text    = strFmt("Item %1 of %2 (%3%)", counter, progressTotal, percent);
       progress.setText(text);
       progress.incCount();
   }
   progress = null;

} </xpp>

Progress Bar within a Method[edit]

On occasion you may want to show a progress bar from a method, whether that be inside a class or just a job. You can show it as follows:

<xpp>

  1. AviFiles

SysOperationProgress progress = new SysOperationProgress();

progress.setAnimation(#....); // from AviFiles macro progress.setCaption("");

//99 Steps to perform progress.setTotal(99);

progress.incCount();

progress.setCount(2);

progress.setCaption("<caption text>");

progress.kill(); </xpp>