What does "this" parameter do in a named query?

So, I see in the 8.1.27 release notes that there's now a convenient button to add the {this} field into named SQL update query parameters. But what does {this} evaluate to? I have no idea what it does and "this" is a pretty awful search keyword so I'm having trouble figuring it out online.


From my prior to ignition coding experiences, I intuitively interpret the word this in the same way as self, but in that context this would be an object, and it simply doesn't make sense to use an object in a query, so...

good question!

The "Scalar Query Update" section on {this} :upside_down_face: page may help shed some light (section quoted below too). I'm assuming it is intended for a similar use case with the Named Query, but maybe not.

Scalar Query Update
You can bind a non dataset type property to a SQL query to allow a singular value to be returned from the database with a scalar query. Now instead of returning multiple rows and columns, the query returns a single value from the first row of the first column. These types of SQL Query bindings can also be used to update the database on input components like a Text Field. Essentially, we mimic the bidirectionality of Tag and property bindings by adding in an update query to run whenever a value gets entered into the property with the binding. In our update query, we use the special parameter {this} to denote the new value from the bound property. If {this} is a string, it needs single quotes around it.

That's exactly what it is. It only applies to the context of a Vision named query binding.

1 Like

I rarely wander through the Vision side of the manual, so I had no idea there are bi-directional named queries on that side of the fence. Any plans to add that sort of functionality to Perspective? I know you can get the same effect with an onChange event script and two named queries (one in each direction), so I understand if it's not planned, but I was impressed with the simplicity for the developer on the Vision binding.

I'm not aware of any plans. From what I remember, there are some big caveats with the Vision approach that make it hard to extend, but I'll never say never :slight_smile:

Modules can add new binding types, too, if I can try to nerd snipe Phil a second time today :laughing:


Hah! Busy with other nerdy things.

1 Like