Periodically updating value of progress indicator

I am developing an app where I need to perform a backend action on a set of rows from a table.
I am doing this in a javascript for loop. At the end of each loop iteration I would like to update the value of a progress indicator. However progress indicator does not have a setValue() method.
Is there any other way I can keep refreshing the value of it ( either periodically or at the end of each iteration ) ?

Hello @thejas and welcome to the community!

If the JS code has a return at the end of it, that will also be returned as the jsQueryName.data property. If you referenced that JS query property inside of the value of the progress indicator, it would update every time the query ran.

As another idea - for any components which don't support a .setValue() method, you can also create a temporary state object, point the progress indicator at that object, and update the object as your queries continue to run. Here's a rough sketch of what that might look like:

You can create temp state by clicking the button in the property inspector on the left, and then set a default value in the inspector on the right.

Let me know if this works!

Thanks for the quick reply. I did exactly that earlier, but there is no periodic refresh of the component. Instead I only see it getting updated after the value reaches 100%.

However I see that for components like a textbox which have setValue() method, I can update the values in each iteration of a JS for loop, and it reflects it immediately.
But for progress indicator, I do not see periodic refresh. Is there a way to force a component to refresh ?

The component should refresh if any of its parameters change - so as the temp state changes the component should be updating. I’m trying to repro this on my end and it’s working for me - mind sending over a screenshot of the query?

As we can see, the progress temp state is at 29 and the progress1 component is set to reflect its value. But the progress indicator is just stuck at its previous final value of 100%.
The JS code is at the bottom.

Fascinating. Any chance you’d be able to write into support (via Intercom) - just link to this chat and we’ll be able to help you there.

I do not have access to it. We have not yet licensed this tool. This is a trial evaluation. I am building a sample app on it.

You should see a little Intercom icon on the bottom right of your screen when you’re in Retool - am I missing something?

oh got it. Reaching out now.

Hello, just chiming in on this old thread. I have am running some queries async and updating the progress temp state value as I go. I find there is a delay in setValue that causes the progress bar to update sporadically. Is there a way around that?

Hi Mariusz!

I am not aware of any way around the delay when using `setValue` unfortunately, but you could potentially use await within the async function, to potentially have better control over the timing. How long of a delay are you seeing?

Hello Justen, after close to 40 queries complete the progress bar doesn't update for good few seconds.

Hey Mariusz! We actually shipped a fix yesterday in v2.70.4 that might see some improvement on the delay on .setValue- can you check how things look at the moment?