# Expression for polling a named query

**URL:** <https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728>\
**Category:** Ignition\
**Tags:** namedqueries, perspective\
**Created:** [September 17, 2025, 6:40pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728 "2025-09-17T18:40:47Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [September 17, 2025, 6:40pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/1 "2025-09-17T18:40:47Z")

</div>

Hello,

I am trying to run a named query based on a change in a PLC tag to update a perspective screen. I have a named query defined and which runs at an absolute rate. How to write an expression for poll rate field, to define a rate based on the tag from PLC like if that is ON, poll rate is this etc.

Thanks

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 17, 2025, 7:11pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/2 "2025-09-17T19:11:21Z")

</div>

It uses expression language, you should be able to do something like

```python
if(
	{[provider]path/to/your/target/tag},
	120, 300
)

```

> **[Expression Language and Syntax | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/expression-language-and-syntax)**
>
> Expression Language

Edit: Less confusing example values

---

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [September 18, 2025, 8:24pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/3 "2025-09-18T20:24:51Z")

</div>

I did the same as above for a dataset on a named query. What I observed is, unless I open the binding and click ‘Ok’, the data is not getting refreshed for the time mentioned. Intention is poll every 6sec for tag ON and 30sec if OFF.

if( {[HighVol\_Upper]Stations/Sta21/Inactivity\_bool}, 6000,30000)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [September 18, 2025, 8:27pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/4 "2025-09-18T20:27:00Z")

</div>

Use the number of seconds, not milliseconds, eg:  
`if( {[HighVol_Upper]Stations/Sta21/Inactivity_bool}, 6, 30)`

Your current expression is evaluating to 6,000s (100 minutes) or 30,000s (500 minutes)

---

<div class="post-metadata">

**Author:** ![Sweetz](https://avatars.discourse-cdn.com/v4/letter/s/dc4da7/32.png) [@Sweetz](https://forum.inductiveautomation.com/u/Sweetz)\
**Post date:** [September 19, 2025, 1:33pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/5 "2025-09-19T13:33:54Z")

</div>

Thank you! I thought it’s in milliseconds.

If I have to add another tag to the same expression, can I use if( {tag1} AND/OR {tag2}, 6, 30) as in meeting both tag conditions or atleast one of them?

---

<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:** [September 19, 2025, 2:40pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/6 "2025-09-19T14:40:27Z")

</div>

`if({tag1} && {tag2}, 6, 30)` - AND version requires both true.  
`if({tag1} || {tag2}, 6, 30)` - OR version requires either or both true.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 19, 2025, 2:47pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/7 "2025-09-19T14:47:42Z")

</div>

I never noticed you can add an expression to the poll rate in a named query binding, lol. Although, I usually turn polling off, and refresh with `refreshBinding()` as needed.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [September 20, 2025, 5:37pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/8 "2025-09-20T17:37:29Z")

</div>

This method will scale, the polling method will not.

---

<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:** [September 20, 2025, 5:46pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/9 "2025-09-20T17:46:29Z")

</div>

Which method?

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [September 20, 2025, 5:48pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/10 "2025-09-20T17:48:26Z")

</div>

> [@dkhayes117](#):
>
> I usually turn polling off, and refresh with `refreshBinding()` as needed.

^^ This method. its effectively only running the query when its required, not constantly in the background. Minimises the unnecessary resource usage, which will bog down your DB server as you put more load on it as you scale.

Any system that polls will become a resource hog as demand grows, thats why you see the rise of webhooks, event based systems (Event Streams) and listeners. Polling is essentially what makes the AB driver use so many resources, it transfers data on a timeline instead of when it changes. MQTT is generally so lightweight because its only normally set up to transmit changes of state, not variables that are stagnant.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [September 20, 2025, 6:26pm UTC](https://forum.inductiveautomation.com/t/expression-for-polling-a-named-query/110728/11 "2025-09-20T18:26:34Z")

</div>

> [@David\_Stone](#):
>
> MQTT is generally so lightweight because its only normally set up to transmit changes of state, not variables that are stagnant.

Keep in mind that MQTT (and built-in PLC OPC servers) still depends on polling, but is doing it outside Ignition. This is why such technologies in PLCs have rather strict quantity limits--those devices have CPUs that are optimized for logic solving, not change detection. (Change detection is additional state to manage, _ **somewhere** _.)
