If you have an application that performs some processing which can take a long time to complete, you should consider displaying a window that informs the user of the progress that is being made.
You can create a window in which each field is updated while the program is running. For example, the fields in a window display the count of the number of postings made. You can also display information about the record that is currently being processed. For example, the field in a window displays the number of the account that is currently being processed.
To create a progress window
On the Tools menu, choose Object Designer.
In Object Designer, select Codeunit, and then choose the New button.
On the View menu, choose C/AL Globals.
On the Variables tab, in the Name field, enter ProgressWindow. In the Data Type field, select Dialog from the drop-down list.
On the Variables tab, on a new line in the Name field, enter ChartOfAcc. In the Data Type field, select Record from the drop-down list. In the Subtype field, select G/L Account from the table list.
In the C/AL Editor for the dialog, add the following code.
ProgressWindow.OPEN('Processing account number #1#######'); REPEAT SLEEP(1000); ProgressWindow.UPDATE(1,ChartOfAcc."No."); // Process the account. UNTIL ChartOfAcc.NEXT = 0; ProgressWindow.CLOSE;
The first line defines the string that will be displayed in the progress window. The part of the string that contains the number signs (#) and a number defines the field that will be displayed in the window. The number (1) refers to the field.
In this example, each entry in the G/L Account table is updated and the number of each account is displayed as it is updated.
SLEEP(1000);function is necessary only to slow the processing so that you can see the progress window.