I think you can achieve your requirement by combining:
In this example I am writing the results to a Dataset type tag, of course you can get more information / props if you need.
# This function was designed to run from a Gateway Scoped call. Client based calls (such as those triggered by a button press) should search in an asynchronous thread.
# Define the search as a function. This makes recursion easier.
# If troubleshooting, you could print out the initPath here
# Create a result set of just tags. This call could be modified to look for a specific sub of tags,
# such as just UDT instances
tagSet = system.tag.browseTags(parentPath = initPath, tagPath = '*',
# Create a result set of just folders. We'll iterate over this set and call browseTags() again for the results.
folderSet = system.tag.browseTags(parentPath = initPath, tagPath = '*',
tagType = 'Folder',
# Iterate through our folders...
for folder in folderSet:
# If troubleshooting, you also could print out folder.path here.
# ...And start the process over again until we run out of folders.
# Return the list of tags.
# Call this on the manual tag provider. Change the intialPath here if searching through a specific Tag Provider.
myTags = manualSearch("[Sample_Tags]")
for myTag in myTags:
tagDefs = system.tag.getAlarmStates(str(myTag))
for tagDef in tagDefs:
AlmSet = system.dataset.toDataSet(headers, data)