I'm trying to use the filterBrowseNode extension function to display only tags with alarms, but it's proving difficult...
If I use this below, I only get tags with alarms in the root folder:
system.perspective.print('{}: {} attr: {}'.format(node.name, node.getDataType(), node.getAttributes()))
if 'alarm' in str(node.getAttributes()):
return True
else:
return False
And the print statements show:
10:20:46.659 [Browser Thread: 62914] INFO Perspective.Designer.Workspace - 5s Clock Pulse: Boolean attr: [NodeAttribute[scripting]]
10:20:46.660 [Browser Thread: 62914] INFO Perspective.Designer.Workspace - Area Filter: DataSet attr: []
10:20:46.660 [Browser Thread: 62914] INFO Perspective.Designer.Workspace - SMS Notification: String attr: []
10:20:46.661 [Browser Thread: 62914] INFO Perspective.Designer.Workspace - Take Thread Dump: Boolean attr: [NodeAttribute[scripting]]
10:20:46.661 [Browser Thread: 62914] INFO Perspective.Designer.Workspace - Test SMS Alarm 2: Boolean attr: [NodeAttribute[scripting], NodeAttribute[alarm]]
for this test folder structure:
Note that SMS Notification/Test SMS Alarm
is completely missing
I've tried adding into the if condition node.getDataType() == 'Folder'
and also converting to str
before comparing, but folders don't appear to be Nodes that are ever returned, so this doesn't work to include folders