SQL query refresh event

ignition 7.5.1.

i’m facing this bug:
my window is parametrized using sql-query-powered numeric labels.
sql-query-powered means:

SELECT val FROM {[Client]tablename} WHERE blablabla

when the page is running, every 15 seconds (the polling base rate), the values changes to another (wrong) value for 1-3 seconds, then comes back to the correct value. i don’t know where the software is taking that wrong value, maybe is another table.

it seems there are 2 refreshing tasks targeting the same label.
or it seems the query is fired by an event that internally is listening changes of 2 variables, one correct and another wrong… i don’t know.

FYI, the query should fire every time it changes, meaning every time that tag value changes.

Are you saying that this recurs every 15 seconds? Ie, you see an incorrect value for 2 seconds, a correct value for 13 seconds, an incorrect value for 2, correct for 13, etc, etc?


Is {[Client]tablename} the only dynamic part of the query? Try dropping a text label on that window that is bound to that tag. Does the value visably change? Alternatively, you could log the value of that tag while your project is running.

Can you think of places where you are writing to that tag in script or have bound properties/expressions? Anything on a timer?

Already tried, no changes.

the tag is set design time, no script writes it.


I would make your query 100% static to see if the same problem happens. It could be an issue with your SQL query. If you want you can post the query here for us to look at. It is possible that the query returns multiple rows and you are getting the wrong one every now and then.

i queried 100% static sql and there is no problem…
the dynamic query is SELECT val FROM tabprefix_{[Client]tablename} WHERE name LIKE '{[Client]deviceprefix}{Root Container.num}Parameter' LIMIT 1
there’s no issue about the query becasue before upgrading to 7.5.1 (b1122) | 64-bit i absolutely had no problem.

Ok, that now gives us something to look into. You need to expose all dynamic parts of the query to the screen as labels. That way you can see which one of them is changing. My guess is the {Root Container.num} is changing and you don’t know it. What is that property bound to? What are the clients tags doing exactly?

You can even expose the entire SQL query as a label to see if it changes. Since the problem is easily replicated you should find out where the problem lies.

You can also call our tech support line at (800) 266-7798 and press 2. They know how to troubleshoot these issues.

as said i displayed every dynamic part of the query into a label and i exposed the entire SQL query as a label and they didn’t change.
{Root Container.num} is not changing.
that property is bound to a dynamic property of the page, set by the page change action when changing the window.
the clients tags are set design time and are not modified runtime: it’s a design choice, useful to configure projects.

Ok. I think you are going to have to call our tech support. It is hard for us to say what is going on through the forum.

I noticed your SQL query is doing a LIMIT 1 without an ORDER BY. So the database is possibly returning a different value each time. It is random which row you will get back. So try adding an ORDER BY clause in your query to get the right row every time.

today i’ve noticed another strange (and tedious) behaviour, and imho it’s related to the previous issue.
consider a template programmed using a parametrized query.

in the editing ide, if the template fires a query error (due to a not yet configured dynamic property, for example) i get the red pop up window (and this is ok).
then i save it, i close it and i include the template in a window and configure it: often i continue to get the red popup windows! furthermore:

  • the error message i see executes the old query even if i closed the template-editing-window!
  • the only way to stop errors is to change project or to exit the ide. no other way to solve…

i think it’s related to the above issue because it could be explained if two object (template) instances remain loaded (and they should not).
any idea?

I’m not sure that the issues are related. After watching the video you posted that displayed the problem you were having we came to the conclusion that the issue you were having was due to the way you were querying your database. You had a LIMIT 1 statement at the end of your query but you did not have an ORDER BY. In this scenario it is possible that every time the query runs you could get a different value if you had more than one record in the database that matches your query criteria.

As for this new issue, I am unable to really get a clear picture of what you’re trying to do. Also, without the exact error messages that are popping up I’m not sure where the error is occurring. The reason you have to change projects or exit the designer is because you have the queries set to poll, which means that they will run probably every 5sec.

You should call in to tech support with this issue and we can to a gotomeeting. It will be easier for us to see exactly what’s going on if we can look at your system.