I have a screen with dozens of controls. Rather than using sql queries to bind each individual control (and have dozens of db calls), I would like to bring all the values over in one or two datasets, then assign the value properties of the labels and such to the appropriate column in the dataset(s). Please advise. D. Lewis
David,
This is a great question. It is much more efficient to bring the data into a window in big chunks (datasets) rather than using individual queries.
To do this, create a custom property (probably on your window’s Root Container) which is of type DataSet. Lets assume that you called the property “MyDS”
Now bind this DataSet property to your query, like “SELECT * FROM TankInfo WHERE TankNum=1”
To get data out of this dataset and into your components, you use an Expression Binding. The Expression Language overview section in the documentation has examples of how to do this. (Available here: http://www.inductiveautomation.com/docs/fpmi/source/technical/expression/overview.htm)
For our example, suppose that the TankInfo table had a column named “Pressure”. To bind the text value of a label to this pressure, you would use the expression:
{Root Container.MyDS}["Pressure"]