Displaying a Progress Bar
There's nothing more frustrating for a user than wondering if the system is done with processing something or not. Displaying an indicator to show the user the system's progress, is an easy way to make the system more user-friendly.
How to do it...
Create a new codeunit from Object Designer.
Add the following global variables:
Name
Type
ProgressBar
Dialog
AmountProcessed
Integer
AmountToProcess
Integer
PercentComplete
Integer
Add the following code to the
OnRun
trigger of your Codeunit:AmountToProcess := 50000; ProgressBar.OPEN('@1@@@@@@@@@@@@@@@@@@@@'); REPEAT AmountProcessed += 1; PercentComplete := ROUND(AmountProcessed / AmountToProcess * 10000, 1); ProgressBar.UPDATE(1, PercentComplete); UNTIL AmountProcessed = AmountToProcess;
Save and close the codeunit.
When you run the codeunit you will see a progress bar like this:
How it works...
In order to track the progress of something, you need to know two things: how much you have to do and how much you...