How to bind data to Perspective Table through a script to avoid polling?

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.

Any pointers?

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.)

Thanks for the suggestion. The table is comprised of data that will be changing every second.

Given that, I don’t see any improvement on using a Tag Change Event Script going to a tag (for binding), vs running a script to rebuild the table at a “now(1000)” rate.

Just to circle back, the hope was to use a script to generate JSON like the following to bind a cell of a table to a tag/property/etc:

        "propConfig": {
          "props.data[0].country": {
            "binding": {
              "config": {
                "fallbackDelay": 2.5,
                "mode": "direct",
                "tagPath": "[System]Gateway/UptimeSeconds"
              },
              "type": "tag"
            }
          }
        }

Another post explained why this can't be done:

You can modify the View’s resource directly to create the bindings via script, if that helps? The gateway looks for changes in the files every 5mins so you won’t see changes for at least 5 mins

You can modify the View’s resource directly...

If your goal is to be efficient (e.g. worrying about the impact of running a script every so often), then mutating the project at runtime is definitely not the route you want to take.

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.