Using a parameter in the Path of a Query Binding

Hi everyone,

I am creating an Object that has a table. I'll use this object for 20-30 different stations, so I'd like to use a parameter to tell the table which Named Query to use. See below:


This doesn't work, and it sure doesn't feel right. Does anyone know a good way to go about this? Using this method (if it works) id have to create Named Queries to store and retrieve data for all 20-30 stations.

You cannot.

Consider a scripted alternative.

A scripted alternative to get data into my tables, as opposed to a query binding?

Yes. A script can use system.db.runNamedQuery with a dynamic NQ name.

So In my table data binding I can create an expression that runs the named Query? Is that what you mean? Would that work?

You could use runScript() in an expression binding, but commonly, one would use a change script on your trigger to run the NQ.

1 Like

I'll give it a try, thanks @pturmel

EDIT: I am using a change script from one of my PLC tags to run the query. How do I get that data into my table? Is there a path to Table.data or do I need to move the query results into a tag first?
This is how inductive U does it, but that's tied to a button in the same view as the table..
image

Edited the above message

Is the tag bound to a custom property of the table? If so, then self is the table. Otherwise, you'll have to figure out the relative path to the table. Or, perhaps, use a view.custom.data and bind your table's props.data to that.

It is now, and I am adding a property change script. this should work! thanks, for the 5th time in a week, @pturmel