# Auto Refresh Binding

**URL:** <https://forum.inductiveautomation.com/t/auto-refresh-binding/90060>\
**Category:** Ignition\
**Tags:** scripting, ignition81, perspective\
**Created:** [May 7, 2024, 6:39pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060 "2024-05-07T18:39:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_L](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@Frank\_L](https://forum.inductiveautomation.com/u/Frank_L)\
**Post date:** [May 7, 2024, 6:39pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/1 "2024-05-07T18:39:50Z")

</div>

I have a table component on a perspective view and created a query binding to the data of the component.'

I want to create a radio group called "Auto Refresh" with the values of "On" and "Off". When "On" is selected, I want it to refresh the table component every 60 seconds automatically. How can this be done?

I thought about a gateway timer script but that applies to the overall environment rather than a particular user running a page in their session. I thought about using polling but I have multiple transform steps after the query. So, I want to refresh the whole binding. Also, I didn't a way to dynamically turn the polling off.

Any ideas on how to solve this problem?

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [May 7, 2024, 6:48pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/2 "2024-05-07T18:48:04Z")

</div>

I would use an Expression binding with "now(60000)" and a Script Transform. Then, if your auto-refresh toggle is true, you can use system.db.runNamedQuery(), return the results and apply further Transforms.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 7, 2024, 8:06pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/3 "2024-05-07T20:06:57Z")

</div>

Regarding the binding: you can't enable or disable it programmatically. It has been discussed several times. See [Dynamic Enable / Disable Perspective Query Binding?](https://forum.inductiveautomation.com/t/dynamic-enable-disable-perspective-query-binding/64100), for example.

Regarding your radio group: I suggest that it's the wrong component for the job. You're setting a boolean so use either a Toggle Switch component or a Checkbox component as would be done on mobile phone apps, etc. Your users know how they work!

![Radio group](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/e/9e4dd508b76dfef8703d8b04a5fec302b193d658.png)  
_Radio group_

![Toggle switch](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/5/8563a1fd47b5bdfd10f9b45d827be417d8ca2525.png)

_Toggle switch._

Less cluttered and you save on real-estate.

---

<div class="post-metadata">

**Author:** ![Frank\_L](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@Frank\_L](https://forum.inductiveautomation.com/u/Frank_L)\
**Post date:** [May 7, 2024, 8:42pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/4 "2024-05-07T20:42:24Z")

</div>

Thanks. It worked perfectly!

---

<div class="post-metadata">

**Author:** ![Frank\_L](https://avatars.discourse-cdn.com/v4/letter/f/839c29/32.png) [@Frank\_L](https://forum.inductiveautomation.com/u/Frank_L)\
**Post date:** [May 7, 2024, 8:42pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/5 "2024-05-07T20:42:55Z")

</div>

Great suggestion. The toggle switch is a much better option.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [May 7, 2024, 8:44pm UTC](https://forum.inductiveautomation.com/t/auto-refresh-binding/90060/6 "2024-05-07T20:44:16Z")

</div>

A workaround assuming that you're using a Query Binding (and that I've convinced you to use a toggle switch):

![Never again](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/4/b448294dde54a225b7425bb1411a77f40a164463.png)

```python
if(
 	{../ToggleSwitch.props.selected},
 	3, // Every 3 s
 	32000000 // "Never again!"
 )

```

Set the Never Again value to more seconds than your server could stay running or enough to get you past retirement. I didn't bother to work it out.

No script - just an expression!
