Ignition Perspective Event Driven Query Tag

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

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?

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.

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?

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. :slight_smile:

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.

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.

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.

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.

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).