Control Cell Update Binding with scripting

Hello all,

I am looking to have a table with a cell update binding. However, depending on an external variable, the tag to point to will be different.
In my example, I have a table with two columns: Motor (string) and Current (float). The Motor column is populated via scripting from a database table. Depending on the results that fill the Motor column, I need to point to the corresponding OPC tag in the Current column. If the Motor column were static I would do this with a cell update binding, but since it varies, I need a way of modifying the binding with a script - the same script that loads the Motor column from the database. I can write an instantaneous value to the cell, but what I want to do is give it a tag path so it shows live values until the script is run again and the Motor column changes.

Is there a way of programming the property binding in python? I have browsed the system.dataset tree but haven’t found what I am looking for.



Use custom properties to build an indirect binding to the motor current, then use a cell binding to place that property in the desired cell (instead of a fixed tag).

I am not sure how that would help me. Perhaps I haven’t explained well enough.

The table is dynamic. The dataset that populates it could have 0, 5 or 20 rows. This is the reason why I need to do it from the script, because it is only there that I know how many rows I need to fill.

The way I understand your suggestion, I would need to have a fixed number of rows and have a cell update binding to each of them. Or maybe I am missing something?



No you’re not missing something. There’s no simple way to do what you are attempting. It probably will require scripting to take a relatively stable dataset of tagpaths and repeatedly look up their current values with scripting, generating an output dataset each time.

Thanks for taking the time to respond.

My hope was that to somehow access the dataset that stores the cell update binding configuration (if such exists) and configure it as I run my script. Perhaps some obscure undocumented scripting function to access the component’s binding configuration.

That way lies madness - this is going to be infinitely easier to maintain, and infinitely less likely to break between Ignition versions, if you either A: give up making it fully dynamic or B: simply do all of your looking up and dataset manipulation in scripting.

Well, I don’t want to venture too deep into the woods, to be honest. I currently have it working with a matrix of labels and numeric labels; it works, but it is not terribly elegant.

How would I do your option B? I am willing to create the dataset and manipulate it in scripting, but how would I keep the values live inside a cell? Updating the dataset periodically?

One option would be a tag change script on the gateway watching all the relevant tags. On change, run your script to create a dataset with the desired data and write it to a dataset tag, and then bind that dataset tag to your table.

I will try that. It looks like an awful lot of script executions, but I will give it a try and see if performance doesn’t get too hard of a hit.

Thanks a lot.

Gateway timer script is another option to run at a set rate (rather than on tag change). If there’s someway to tell it when updates are necessary, you could check that at the start of your script so it only executes the rest of the code if necessary.

If the list of tags doesn’t change often, you could make it more efficient by having your script generate a list of tags, save it to a string tag, and then use that list in your bindings. I used this method on an old batch system that stored the recipe in each ingredient feeder–loop through all the feeders to find non-zero ingredients and assemble a list of their root tags, then use those to bind ingredient progress displays to the active feeders so operators would not have to look through all the feeders to figure out how the batch was progressing.