Controlling the order in which components update

I have a dynamic property which queries for a controller_type definition.

Elsewhere on the same page, I have a container with a bunch of identical components, reading the status of bits in a database word and retrieving labels for those bits as well. The controller_type from above is a part of the query that finds the correct labels for the bits.

The first time I open this window, I get an error - the query has controller type “null”. There are 16 bits, but the number of errors varies, always less than 16 of course.

It seems that several, but not all, of the bit label queries are running before the controller_type query can complete.

Suggestions?

I don’t exactly understand the dependencies that you’re describing, but you should be able to set things up in such a way that no query is ever in an invalid state. If you save the window in a valid state, then the controller type should never be null.

I started writing this a while ago and forgot about it. It expounds a bit on what Carl said… especially #1

There’s probably a few quick solutions:

  1. Save the window with some non-null value for controller_type. That is, even though it’s coming from the DB, if you turn off DB traffic in the designer, you can edit it’s value however you want. When you save, this value will be locked in. Now when you open the window, you’ll just have an incorrect value for that split second, instead of getting errors.

  2. Modify your bindings/query to handle the null. This is commonly done through expressions or query keywords. I’d guess your query is erroring out because it looks something like “SELECT val FROM table WHERE c_type={controller_type}” and when it runs with null that reference gets replaced with nothing and it’s an invalid query. Instead of referencing the value directly, you could add a dynamic property, and use an expression to a) return the value if not null or b) return some other value if null, like -1, and then refer to that dynamic property in your query so that you know there will always be a value provided.

Regards,