Displaying the progress bar and data in process
During the execution of a big batch job or reports, if the system is not displaying any progress information it can be frustrating and confusing. To avoid this for our customers, we should always display the progress bar and/or data in progress.
How to do it...
Let's get started by creating a new codeunit from Object Designer.
Add the following global variables:
Name
Type
ProgressBar
Dialog
AmountProcessed
Integer
AmountToProcess
Integer
PercentCompleted
Integer
Now let's add the following code to the
OnRun
trigger of the codeunit:AmountToProcess := 500000; ProgressBar.OPEN('@1@@@@@@@@@@@\#2############'); REPEAT AmountProcessed += 1; PercentComplete := ROUND(AmountProcessed / AmountToProcess *10000, 1); ProgressBar.UPDATE(1, PercentComplete); ProgressBar.UPDATE(2, PercentComplete); UNTIL AmountProcessed = AmountToProcess;
Save and close the codeunit.
On execution of the codeunit, you should see a window similar to the...