# How to Update Non Polling Expression Client Tag

**URL:** <https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385>\
**Category:** Ignition\
**Created:** [August 24, 2015, 4:39am UTC](https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385 "2015-08-24T04:39:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [August 24, 2015, 4:39am UTC](https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385/1 "2015-08-24T04:39:38Z")

</div>

I have a client tag that is a datset based on a SQL query. If I set the Polling Mode to Off, how can I get the tag to update its value when the data in the database table changes?

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [August 24, 2015, 11:07am UTC](https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385/2 "2015-08-24T11:07:44Z")

</div>

You would have to read the data in the database somehow to know when you needed to update the dataset, so I don’t think you can do this automatically without polling. You can trigger the update manually off a button press if that would work.

---

<div class="post-metadata">

**Author:** ![denji26](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/denji26/32/5805_2.png) [@denji26](https://forum.inductiveautomation.com/u/denji26)\
**Post date:** [August 24, 2015, 2:44pm UTC](https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385/3 "2015-08-24T14:44:59Z")

</div>

That would indeed work. By what mechanism would I do that? 🙂

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [August 24, 2015, 5:48pm UTC](https://forum.inductiveautomation.com/t/how-to-update-non-polling-expression-client-tag/10385/4 "2015-08-24T17:48:07Z")

</div>

You can do this one of 2 ways: binding or scripting.

Binding

1. Create a Client tag called ‘trigger’ with Data Type Boolean.
2. Create a client tag of Data Type DataSet. Set its Expression Type to SQL Query, its Polling Mode Off and the query to `SELECT * FROM table WHERE {[~]trigger}={[~]trigger}`
3. Create a button and set its actionPerformed script to `value = system.tag.read('[Client]trigger').value
system.tag.writeToTag('[Client]trigger', not value)`When you click the button, the value of the tag ‘trigger’ will be toggled. This will change the text inside the SQL Query from `SELECT * FROM Table WHERE 0=0` to `SELECT * FROM Table WHERE 1=1`This won’t change the result of the query but will force it to be updated.

Scripting

1. Create a Client tag of Data Type DataSet.
2. Create a button and set its actionPerformed script to `data = system.db.runQuery("SELECT * FROM table")
system.tag.write("[Client]Scripting tag", system.dataset.toDataSet(data))`When you press the button the query will be run and the tag updated with the result.
