# Ignition Perspective Event Driven Query Tag

**URL:** <https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229>\
**Category:** Ignition\
**Created:** [August 7, 2019, 1:39pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229 "2019-08-07T13:39:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 7, 2019, 1:39pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/1 "2019-08-07T13:39:47Z")

</div>

Hello, I cannot find an example of how to tie a mouse click in Perspective to an EVENT DRIVEN query tag. Can you link me to an example for this?

David

 ![Ignition_persp_eventdrivenquery](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/7e7b7b0314f2a95f94d26b926802f2b06232a2b6.jpeg)

---

<div class="post-metadata">

**Author:** ![md.szyman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/md.szyman/32/9240_2.png) [@md.szyman](https://forum.inductiveautomation.com/u/md.szyman)\
**Post date:** [August 7, 2019, 1:41pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/2 "2019-08-07T13:41:07Z")

</div>

What do you mean by “tie a mouse click to a query tag”? Do you mean you want the mouse click to update the tag/refresh the query?

---

<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:** [August 7, 2019, 2:12pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/3 "2019-08-07T14:12:16Z")

</div>

Event driven expression or query tags are updated when a referenced parameter changes. If there’s no outside parameter referenced, they never update. If the updates you wish to perform are always triggered by scripting, consider using a memory tag and have the scripts compute and write the new value as needed.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 7, 2019, 5:56pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/4 "2019-08-07T17:56:38Z")

</div>

Thank you. I will look at doing an expression to update a memory tag and see if that works well. I will need to set a flag high and then off so it can be run again. Any suggestion on that?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 7, 2019, 6:08pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/5 "2019-08-07T18:08:49Z")

</div>

Hi David,

Let’s back up for a moment and tell us what your looking to do. There may be another way than using an expression to get to where you want to go. 🙂

---

<div class="post-metadata">

**Author:** ![jlivingston](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jlivingston](https://forum.inductiveautomation.com/u/jlivingston)\
**Post date:** [August 7, 2019, 6:39pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/6 "2019-08-07T18:39:05Z")

</div>

There may be some hints in the following train of forum answers, specifically 5 of 8 and 8 of 8 (colon would possibly produce an emoji here ) do add the letter h to this URL so that it is NOT just seen as the first message of 8: ( add the letter h in your browser before this )  
ttps://forum.inductiveautomation.com/t/pdf-viewer-event-handlers/26795  
Yes, they were looking at PDF- not Query- yet the mouse click in Perspective is examined.  
Post #8 (the last one) may help most of all.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 7, 2019, 6:59pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/7 "2019-08-07T18:59:56Z")

</div>

Hello, what I am trying to do is this.

1. Using a TAG \> NEW STANDARD TAG \> QUERY TAG that points to values from a SELECT TOP 10 \* query.
2. I currently use the FIXED RATE to refresh the data
3. I want to use the EVENT DRIVEN option to refresh the data.

---

<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:** [August 7, 2019, 7:55pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/8 "2019-08-07T19:55:28Z")

</div>

Event driven is based on a change within the text of the query or a value passed to the query. You have static query text and values, so you can’t use event driven.

Run the query in a script function instead, saving the result to your tag (as a memory tag). Call the script function whenever you want.

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 7, 2019, 8:27pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/9 "2019-08-07T20:27:56Z")

</div>

I need the values to be refreshed in a Table. I do not want to use Named Query. My issue is tying the data from the SELECT to the Table.

---

<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:** [August 7, 2019, 9:41pm UTC](https://forum.inductiveautomation.com/t/ignition-perspective-event-driven-query-tag/27229/10 "2019-08-07T21:41:06Z")

</div>

Your mouse click event runs a script. That script runs the query via system.db.runQuery(). (Doesn’t have to be a named query.) The script writes the query results dataset to the memory tag. A side effect of writing to the memory tag will be updates to any component (Vision or Perspective) bound to it (like the data property of your table).
