We’ve all faced situations where we’ve had an operation take a long while which made the User wonder whether the system is stuck with something or is still processing.
We can use simple dialogs which can enhance the User experience by showing User the progress of the operation.
Some Business Central operations have out of the box dialogs which indicate progress like Posting documents or entries, Running reports with large data sets.
Business Central OnCloud/OnPrem
While using the Dialog for creating windows, there are 3 procedures that we are going to be using.
- Open – It creates the window which we will be displaying the messages in.
- Update – It updates the content of the window based on the values that we pass in it.
- Close – It closes the window.
We can create a simple Progress Window using the below piece of code.
And this is the result for it.
Please note that because there were two # in the Label, system has broken them into two separate lines.
To avoid creating multiple lines within a single dialog box, we can use the StrSubstNo procedure which compresses the number of updates that we call to 1.
We can now see that the content is visible in a single line.
In Business Central 14 or previous versions of Business Central (which used windows client) it was possible to show the progress indicator in percentages using native APIs, however this functionality is not supported in Web Client.
However we can still simulate it using text and creating our own basic procedure which converts the values to a String which will be used to indicate the progress.
Thus we saw how we can use Dialogs to enhance User Experience and allow Users to visualize the processing of some long running task.