Tag Updates within Perspective Table

Hello,
I am working with the table component of Perspective.
The data displayed in the table comes from a binding with a script reading OPC Tags.

The solution may be very simple but I can’t figure it out : my issue is that after the data being imported in the table when starting the sesssion, the value of the tags won’t be updated unless the binding is refreshed.

Is there a way to dynamically show the tag value in the table components, using multiple OPC tags ?
Should I have a timer to refresh the binding periodically ?

Is it runScript() or a transform?

Yes.

Reading tags in a script does not make a subscription. You must read repeatedly to keep the data fresh. Consider using custom properties with tag bindings to monitor the live tag values. Pass those properties to a script to assemble the dataset in the displayable form you like.

1 Like

It is a transform

I will try this thank you !

Does this mean I have to create a custom property for each tag I want to monitor ?
I have a thousand of them :sweat_smile:

Oy! A thousand props would be a bit much. Your current approach, but with a timed refresh, may be the best choice after all.

My issue is that I want to only refresh the value of the tags, but I have other data in my dataset that I want to keep.
I figured a way to refresh only the values but this makes a “glitch” on the screen when updating, it lay be a timer issue.

I have implemented a timer but when the value of the tag updates, the other values of the table reset as the table was first configured.

for exemple : I edit column_4 to be True, and after the update of the column_2 (which is every 5 seconds with my timer script), it comes back to False

I have an event on the table “onEditCellComit” to keep the edited value, and it works without the timer activated.
Here is my timer script in a “onStartUp” event on the table :

image

Is there a solution to prevent the other columns from reseting ?

Don’t use an infinite loop in any event! (Nor sleeping of any kind, though Perspective is more tolerant than Vision.)

Bind the now(5000) expression to a custom property to get a value that updates automatically every five seconds. Attach an onChange event to that property to run your tag update script.

2 Likes

Thanks a lot !! It was really the missing part we needed !

Does it have to be a table? Can you use the flex repeater and create “rows” with it? You can then use indirect binding to display the value.

Love this thread… Real big help! Thank you pturmel.