[SOLVED] How do you refresh a component binding through scripting?

Specifically I have a button component on a template and I want to refresh the binding on the enabled property. An event happens on the main screen and several of these templates need to be refreshed. I can do this manually by saving the project but haven’t been able make the process automatic. Any help is appreciated.

You use the (terribly placed) system.db.refresh() function:
https://docs.inductiveautomation.com/display/DOC80/system.db.refresh
In some future release I’d like for us to move that to a system.vision package.

5 Likes

… and make it work with Vision Client Tags that have bindings. (:

I think that did the trick…

if event.propertyName == 'instruction_Curr':
    component_Name = event.source.getComponent('btnDown')
    system.db.refresh(component_Name, 'Enabled')

    component_Name = event.source.getComponent('btnDown_Big')
    system.db.refresh(component_Name, 'Enabled')

I had even looked at that link and was thinking “well it says it’s for SQL stuff so I can’t use it…”

2 Likes