Perspective Table - refreshBinding from button not working

Im trying to refresh a binding i have on a Perspective Tables "props.data" from a button and cant get it to work. Im using a message handler on the Table and calling it from the button. My binding on props.data is a dataset tag that has a script transform that changes rows background color based on a value, so its not a polled binding like a query or history( not sure if this is the issue)

Script on Table:
image

Script on Button:

Start by adding some logging in your message handler to see if it does catch the message.

In the (probable) case it doesn't, check the scope, and try a handler name without spaces.

2 Likes

May need to define the scope..

https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage

If you're bound to a tag, then you'll always have the latest value. Refreshing the Binding will do nothing because if neither the value nor quality change the binding won't update. Are you just trying to re-execute the transform of the binding?

2 Likes

yes i am trying to re-execute the transform.

Use a structure binding instead then.
Structure bindings have several sources of data, when any of them is updated the whole thing is re-evaluated.

As @pascal.fragnoud suggested, it sounds like an Expression Structure binding is going to work best for you. From the request, it sounds like your displayed data is not strictly reliant on the data of the Tag, rather, it is reliant on the Tag AND some other information. As such, a regular binding with a Transform won't work for you.

Optionally, you could use the Tag binding, and instead of "refreshing" the binding, you could place the transform code into a project script and reference that script in the transform. Then, your button press would not refresh the binding, it would actually SET the data of the Table be reading the Tag data and referncing the project script before then applying the data to the Table: self.getSibling("Table").props.data = X.

1 Like

Thanks everyone for your inputs, i ended up changing the main binding tag path of the table to the tag that actually changes and reworked my transform script to include my dataset so now the tag binding changes thus the transform script executes again.