Has anybody created a window that generates it’s components dynamically based on passed parameters?
For example, one device may have 3 thermocouples while another device has 2 thermocouples. The project has a popup that shows the values of these temperature readings, but it is a hassle building individual screens for each possible combination of thermocouples (TemperaturePopup_1Value, TemperaturePopup_2Value, TemperaturePopup_3Value, etc.). It would be easier to script the open window action to call the popup similar to:
I am interested in this also. what I have been doing for now is making a tag on each device and just disabling the tags that arent used. I then make the visibility based on if the tag is enabled or not. kind of inefficient but it works I guess.
I am looking more toward using a table component and the new system.tag.gettagvalues function. I guess my biggest issue would be having the script skip a tag that does not exist without throwing an error.
That is something I’m dealing with implementing now. I’m planning on adding a script to the local project to avoid these exceptions somewhat like:
def safeTagRead(tagPath):
result = ""
try:
result = str(system.tag.getTagValue(tagPath)
except: # catches all exceptions #
result = "" # or whatever string you want to represent failure to read with #
return result