Hi,
As the title says can you somehow see how many tags is connected to a tag group?
I know I could browse all my tags and count the amount of tags in each tag group, but I was hoping for a more readily available method.
Thanks
Hi,
As the title says can you somehow see how many tags is connected to a tag group?
I know I could browse all my tags and count the amount of tags in each tag group, but I was hoping for a more readily available method.
Thanks
The tag report tool should be able to do this.
Hey Esn,
I was looking to do the same quickly to see where my bottlenecks are, see the below:
provider = ''
path = 'Modules/AnalogueInput/*'
query = {
"options": {
"includeUdtMembers": True,
"includeUdtDefinitions": False
},
"condition": {
"path": path,
"tagType": "AtomicTag",
"attributes": {
"values": [],
"requireAll": True
}
},
"returnProperties": [
"tagGroup"
]
}
results = system.tag.query(provider, query)
# If the tag group already exists, add one, if not, add to dict with a count of one
tagGroupCount = {}
for result in results:
tagGroup = result['tagGroup']
if tagGroup in tagGroupCount:
tagGroupCount[tagGroup] += 1
else:
tagGroupCount[tagGroup] = 1
# Max string length for displaying neatly
max_length = max(len(result) for result in tagGroupCount)
# Print the results
print "Tag Group" + " " * (max_length - 7) + "Count"
print "-" * (max_length + 12)
for tagGroup, count in tagGroupCount.items():
print tagGroup + " " * (max_length - len(tagGroup) + 2) + str(count)
Gives a neat output:
Tag Group Count
-----------------------------
Parameters 1 2500
Alarm Detail 1 7000
Settings 1 500
State 1 750
Feedback 1 500
Inputs 1 250
Status 1 2250
Alarm Status 1 1750
Overrides 1250
Alarm Query Tag 1 10500
Detail 1 750
Requests 1 1750
No judging on the code. Thanks!
Josh