# Generate a list of alarm display paths in project?

**URL:** <https://forum.inductiveautomation.com/t/generate-a-list-of-alarm-display-paths-in-project/76103>\
**Category:** Ignition\
**Created:** [July 8, 2023, 10:38pm UTC](https://forum.inductiveautomation.com/t/generate-a-list-of-alarm-display-paths-in-project/76103 "2023-07-08T22:38:55Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 10, 2023, 1:38am UTC](https://forum.inductiveautomation.com/t/generate-a-list-of-alarm-display-paths-in-project/76103/6 "2023-07-10T01:38:28Z")

</div>

I remember there being an issue with using queryStatus - I remember it excluding some tags.

Here's what I use to get a list of all configured alarms and their properties, originally written by @Kyle_Chase

> [@How to Generate a List of all Configured Alarms](https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/6):
>
> Here is what we use. Put this in a project script or on a button, and call getAlarms(rootPath). It will return a list. You will want to run this from the gateway, as it is a recursive browse. Invoke with sendRequest or sendRequestAsync. def getAlarms(tagPath): from com.inductiveautomation.ignition.common.tags.paths.parser import TagPathParser alarms = [] def iterTagConfig(dictIn, folderIn = ''): keys = dictIn.keys() #Move tags and alarms to end of list. I do not recall why, but it…

```auto
"""
Description:
	Finds all alarms within a given tagpath and return a bunch of the alarm properties.
	https://forum.inductiveautomation.com/t/how-to-generate-a-list-of-all-configured-alarms/36651/6?u=nminchin
Revision History:
    Rev Date Author Comment
    1.0 ?? Kyle Chase Original
    1.1 2022-10-21 Nick Minchin Fixed bit in tagpath. Wrote results to clipboard as a CSV
Return:
    CVS to clipboard with alarm tag paths and collection of alarm properties.
"""

path = '[default]Wynns/Winery/Tank Farms/Fermenters/SWAP/Tanks/C168'

def getAlarms(tagPath):	

	from com.inductiveautomation.ignition.common.tags.paths.parser import TagPathParser
	alarms = []
	def iterTagConfig(dictIn, folderIn = ''):
		keys = dictIn.keys()
		#Move tags and alarms to end of list. I do not recall why, but it is really, really important.
		if 'tags' in keys:
			keys.append(keys.pop(keys.index('tags')))
		if 'alarms' in keys:
			keys.append(keys.pop(keys.index('alarms')))
			
		for key in keys:
			#If the value of dictIn[key] is a dict, then it is a folder like structure that has child tags. Iterate through this
			if isinstance(dictIn[key], dict):
				iterTagConfig(dictIn[key])
			elif key == 'tags':
				for tag in dictIn[key]:
					if str(tag["path"]) != "_types_":
						iterTagConfig(tag, folderIn = folderIn + '/' + str(dictIn['path']) + '/' if folderIn else str(dictIn['path']))	  
			elif key == 'alarms':
				#This is what we are looking for. Each tag in this alarm item is an alarm, so we add them to the list. Use qualified tag paths because they are exact, and I hear they make you look cooler.
				for tag in dictIn[key]:
					tp = TagPathParser.parseSafe(folderIn+"/"+str(dictIn['path']) if folderIn else str(dictIn['path']))
					qp = "prov:%s:/tag:%s:/alm:%s"%(tp.source,tp.toStringPartial(),tag["name"])
					p = tag.get('priority', '')
					a = tag.get('activePipeline', '')
					dp = tag.get('displayPath', '')
					label = tag.get('label', '')
					name = tag.get('name', '')
					
					alarms.append([tp, p, a, dp, label, name])
					iterTagConfig(tag,folderIn = folderIn + str(dictIn['path']))	
	if tagPath:
		folder = tagPath
		#Root level browse
		nodes = system.tag.getConfiguration(folder, True)
	
		for item in nodes:
			iterTagConfig(item)
	
	return alarms

csv = '"tagpath","priority","activePipeline","displayPath","label","name"\r\n'
for t in getAlarms(path):
	csv += '"' + '","'.join([str(tt) for tt in t]) + '"\r\n'

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/generate-a-list-of-alarm-display-paths-in-project/76103)._
