Within a popup window I have a template repeater. Depending on tag that is used for the popup I could have anywhere from 0-50+ instances in this repeater.
I have a script that scans the appropriate areas in the tag and generates the dictionary list to fill in the "instances" with the appropriate parameters.
below is an example of an instances list
For this "Active" can change state at any time and Alarm Type should change based on a tab selection within that popup.
If these were fixed # instances I could do a property binding on each item that I need to update after the instances are loaded.
Is there a way to add the property binding to the instance build?
For example here are my instances
[
{
"Active": true,
"OutputDBID": 10001,
"OutputPLC": 1,
"BitMask": 4,
"AlarmType": 3
},
{
"Active": true,
"OutputDBID": 10002,
"OutputPLC": 1,
"BitMask": 7,
"AlarmType": 3
},
{
"Active": true,
"OutputDBID": 10003,
"OutputPLC": 1,
"BitMask": 15,
"AlarmType": 3
}
]
Here is property binding I would want on every "Active"
}
"type": "property",
"config": {
"path": "this.custom.SelectedActiveSD"
}
and property binding on every "AlarmType"
{
"type": "property",
"config": {
"path": "this.custom.ActiveSelected"
}
}
Currently when it initially loads everything shows correct but if either of the values that I am showing property bindings changes then the instance list doesn't update...
I guess the other thing I could do is put a property change script on the 2 custom parameters shown above to force update the instance list... That feels more demanding on system though.
Just for reference here is my script that generates my dict list for the instances.
def outputList(AlarmType, Active, tagPath):
tags = system.tag.browse(tagPath +'/Database Actions')
tagPaths =[]
result = []
fullList = []
for tag in tags:
basePath = str(tag["fullPath"])
path = basePath + "/Output Bit Mask"
tagPaths.append(path)
path = basePath +"/Output PLC"
tagPaths.append(path)
path = basePath + "/Output DBID"
tagPaths.append(path)
values = system.tag.readBlocking(tagPaths)
for value in values:
fullList.append(value.value)
valueList = [fullList[i: i+3] for i in range(0, len(fullList), 3)]
for output in valueList:
BitMask = output[0]
OutputPLC = output[1]
OutputDBID = output[2]
if OutputDBID >0 and OutputPLC >0:
result.append({"Active": Active, "AlarmType": AlarmType, "BitMask": BitMask, "OutputDBID": OutputDBID, "OutputPLC": OutputPLC})
return result