I’d like to bind different actions for different components in a flex repeater on value change of that component , action content is from a field of DB table , everything is working well if I manually set by [add change script] when I right click property , my problem is I have to dynamically bind them by setting propConfig due to too many components .
Python functions are first-class objects, and can be dynamically picked out of a script module with the getattr() built-in function. Create a script module with a function for each allowed action. Place the function name in a column of your DB table of component definitions.
Works:
p = getattr(self, "props")
Doesn't work
p = getattr(self, "propConfig")
I can see propConfig is out there, just can not get and set, logs: AttributeError: 'com.inductiveautomation.perspective.gateway.script' object has no attribute 'propConfig'
You simply cannot dynamically create bindings at runtime. It’s something a few ‘power users’ have asked for, but we don’t have any concrete plans to implement such a thing at the moment. If you just want to quickly create many views, you could theoretically try to create a well-formed JSON structure and write it to the filesystem - but I’d advise against such a thing.
What do you do if tag value changes? In my case , I wanna do following steps:
Build info and store into DB or Update certain fields maybe also.
My case is :
1. Build info by Scanning bar code
2. Update a field after a few minutes with another bar code from another PLC
Update UI intermediately( This feature I could implement by fetching data very often )
Adding a script in value change field?
Using multiple tags…
Use another tag like a watch dog to perform a trigger to update the UI
I don’t know, there will always be another path to take in my opinion.
You can even use JSON or XLM to build, store and retrieve tags as well