How to get Progress Bar at the Time of Process Execution?

How to get progress bar at the time of process execution?

Introduction: A progress bar is a visual representation of the status of a process, providing users with a clear indication of process execution. It enhances user experience by keeping them informed, particularly during long-running tasks like file downloads, data processing, or installations.

High level resolution steps

Create a method which calls the sleep method.

Call this method in the beginning of business logic execution.

Detailed resolution steps

Step 1: Create a ‘beginWaiting‘custom method which calls the sleep method.

Step 2: Call ‘beginWating’ method as shown in the below screen shot before the execution of business logic

Code Snippet


internal final class SCC_ProgressBar
{
    /// 
    /// Class entry point. The system will call this method when a designated menu 
    /// is selected or when execution starts and this class is set as the startup class.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
    {
        int i = 5000; 

        SysOperationSandbox::callStaticMethod(classNum(SCC_ProgressBar), staticMethodStr(SCC_ProgressBar, beginWaiting), conNull(), "Executing the Logic...");

        while (i < 5000)
        {
            //BusinessLogic can be done here.
        }
    }

    public static void beginWaiting(container _con)
    {
        sleep(1);
    }
}

    

Code explanation

1. Define a class named SCC_ProgressBar

2. Create a public static method called main, which serves as the entry point for execution.

3. Accepts a parameter of type Args to handle arguments passed to the method.

4. Calls the static method beginWaiting from the SCC_ProgressBar class using SysOperationSandbox::CallStaticMethod.

Output

In this scenario, I have created a runnable class to test the progress bar. When the class is executed, the output is displayed as shown below.