Question


Optum Global Solutions
IN
Last activity: 6 Oct 2021 12:03 EDT
How to add a progress bar in a RDA(Robotics Desktop Automation) to indicate the user of the ongoing process.
Hi,
I have created a robotics(RDA) application where some data is displayed in a DataGridView on a windows form on the click of a button.I would like to add a progress bar to indicate the user that some process is going on while the data is being fetched from the internal application to be displayed.
I have found the progress bar within the tool box however I am unsure how to show the progress bar when the automation starts and hide when the process completes.
Any advice would be much appreciated.
Thank you,
Megha
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Updated: 6 Oct 2021 12:03 EDT


Pegasystems Inc.
US
@MeghaSinhaA windows form only has one thread available to draw the UI. If you trigger a process off of your UI, you will need to launch that on another thread in order to make the UI responsive while another process is running. If you notice in my example, I am calling the "DoSomeAdapterStuff" using an asynch link as this creates a new thread.
Another method of creating a new thread would be to use an activity as StartActivity puts the activity on a queue and ends that thread of execution. The ActivityStarted event will be in a new thread.
As for populating your DataGridView, you will need to make sure that is populated on the windows form thread. I would suggest that you do the following;
- Have you "Get Work Item" button click call anything using an asynch link.
- Have your REST call acquire whatever data it does.
- At the end of that thread have the automation call PerformClick on a new button on your UI. This button would be placed behind another control (I usually just place it right in the middle of my DataGridView and select "Send to back" to make it unavailable to the user (also disabled the TabStop property so it is inaccessible).
- Use the Click event from this button to copy the data from the automation into the DataGridView.


Pegasystems Inc.
US
@MeghaSinha The progress bar is deceptively simple. When you wish to reset it back to its initial value, simply set the Value property to zero. When you wish to indicate progress, simply call the Step method. There's really no true way to measure the progress, so it is up to you to determine when you'd like to perform a step and how much progress that shows.
You can use things like the GlobalDictionary or the new variables to trigger events that you can use to step through the progress bar (just so that you don't need to update it inside of unrelated automations). Basically, you'd update the GlobalDictionary (or variable if you want to keep everything within a single project) value in your automation to cause the current value to change. That would fire an event that you can listen for in your UI automations and use that to perform a step in your Progress Bar.


Optum Global Solutions
IN
Let me rephrase my question,I am looking for a way to notify the user that the process is in progress after they have initiated the event by clicking the button on windows form.Something like a spinning wheel or hourglass feature,if you will.
Not sure if that is something which can be implemented using Pega robotics.I am assuming progress bar is somewhat near to that feature but having difficulty implementing it.
I have attached the screenshot of the windows form where the click of the "Get work item" button triggers the bot to fetch the data and display in the datagridview below the button.
Do we have a sample solution with a progress bar implemented in a RDA solution to help me with it.


Pegasystems Inc.
US
@MeghaSinha Here is a quick example. Progress bars aren't generally accurate in terms of tracking the percentage of a process being complete as that requires you to really think about when and how much you update the progress bar during your process. I generally just update them regularly throughout the process and then stop stepping the progress bar when it reaches 90%.
Another option I have seen (and used myself) are loading images. I added one as well so you can see that. Basically, it is just some GIF that is visible while the process is running.
One other option we use a lot is a separate UI that we show in the lower right corner of the screen to display what is running and for how long i has been running.


Optum Global Solutions
IN
Thank you for your prompt response. The picture loading component looks like something meeting our business needs.
Just a small query, the image that has been added to the image property of the picture loading component is a system generated one. I can see it shows "System.Drawing.Bitmap" in the value. How do I set the image property to "System.Drawing.Bitmap".
Updated: 6 Oct 2021 9:14 EDT


Pegasystems Inc.
US
@MeghaSinha Just click on the ellipses in the properties panel and you can select your own image.


Optum Global Solutions
IN
I was able to add the image in the picture box component, but when I run the solution the picture appears as stagnant though it is a gif file.I tried multiple things to fix the issue but nothing seems to work.
The datagridview in the form is being populated after the "Get work item" button is clicked using data from a rest service.Is that by chance the reason behind the picture box component not working as expected.
I have attached a screenshot of the windows form with the picture box.
Accepted Solution
Updated: 6 Oct 2021 12:03 EDT


Pegasystems Inc.
US
@MeghaSinhaA windows form only has one thread available to draw the UI. If you trigger a process off of your UI, you will need to launch that on another thread in order to make the UI responsive while another process is running. If you notice in my example, I am calling the "DoSomeAdapterStuff" using an asynch link as this creates a new thread.
Another method of creating a new thread would be to use an activity as StartActivity puts the activity on a queue and ends that thread of execution. The ActivityStarted event will be in a new thread.
As for populating your DataGridView, you will need to make sure that is populated on the windows form thread. I would suggest that you do the following;
- Have you "Get Work Item" button click call anything using an asynch link.
- Have your REST call acquire whatever data it does.
- At the end of that thread have the automation call PerformClick on a new button on your UI. This button would be placed behind another control (I usually just place it right in the middle of my DataGridView and select "Send to back" to make it unavailable to the user (also disabled the TabStop property so it is inaccessible).
- Use the Click event from this button to copy the data from the automation into the DataGridView.