My tag structure is multiple folders with tags underneath each of them (similar to a UDT). I want to display data from these tags in a table where each row represents a folder and each column represents a tag. When the data changes, I want the cells of the table to be updated.
I am building the structure of the table by parsing the tag structure through scripting, and I include the tag values at that time. I don’t know how to get subsequent updates except by running the script again to build out the structure again with updated values.
You are going to have to run that script to regenerate your table. You can avoid polling by using a gateway tag change event script to monitor all of the tags, and update a single tag that represents a “trigger” to re-run your script. (Bind the trigger to a custom property in that view, and run the script from that property’s change event.)
This was offered as a means to create the many bindings rather than as a way to be regularly called to update values dynamically. There’s a max 5min (by default) delay before project resource changes are picked up by the gateway, so this would be an impractical solution for regular periodic updates.
The question was, paraphrasing:
How do I use a script to create the bindings on table cells to tags/properties/etc?
Ah yes, that makes more sense. You certainly could do this. Or if it is a one-off exercise, you could simply shift-right-click on a view node, select “Copy to JSON”, modify the source as you see fit, and then shift-right-click again to paste your new programmatically-enhanced view back in.
The best solution for my use-case is to either add a new Perspective Table component, or modify the existing Table component where each column contains a common expression/tag/property binding definition for all rows within that column, where the binding can reference the value provided by the defined row.
It would work similar to how viewParams work for FlexRepeaters. My use case would be to have the column define an expression binding using the row data to start a tagPath, and static text in the expression binding to complete the tag path. This would allow me to include strings representing tagPaths to feed to the expression bindings, rather than the raw data itself.
I actually mocked up a similar concept by creating a SubView with label, each with an expression binding being fed by the viewParams. This works to display the data, but breaks any ability to filter the rows or sort the rows from a column.