Creating Multiple Alarms

Hello,
Is there an easy way to create multiple tags with an associated alarm? I’ve thought at 3 possible ways:

  1. Do it one at the time:
    Handly create a tag and set the alarm, but if I have to create 200 alarms it will be an insane waste of time.
  2. Export in an .xml file:
    I can create a tag as I want, then export it in an .xml file ( only .xml because the .csv does not support the alarm properties),
    open it with Notepad++, copy / paste the “code” and manually modify the right line. Even this will be an insane waste of time.
  3. Scripting:
    I can create a DB table with x column where x is the number of dynamic properties I need. ( for example: Tag_Name, OPC_Path, Alarm_Name, and so on ) Create a script where I do a SELECT query for read all the data and put them into List ( one List for every column), use the function system.tag.addTag(“the right configuration”)giving it the Lists as a dynamic array and finally put all of this inside a loop. Well, I found this very obsolete for being in 2017 ( almost 2018 ).

I often import tags from a csv to do large tag creations. I set up a spreadsheet with the columns I need (tag name, parent path, tag and data type, etc) and any tag attributes (Tooltip, EngUnit, etc) then write some scripts to import the csv and create the tags. It’s a pretty straight forward process. Here’s a bit of sample code without alarms.

import csv

# imports from csv with columns  Tag Name,Address,Data Type,Tooltip,Documentation

pp = '[default]Some Machine' 
tagType = "OPC"
attributes = {}
attributes["OPCServer"] = "Ignition OPC-UA Server"

filepath = system.file.openFile('csv')
if filepath is not None:
	inData = csv.reader(open(filepath))
	pDs = [x for x in inData]
	for i in range(1,len(pDs)):
		if i > 0:					
			tagName =  pDs[i][0]
			attributes["OPCItemPath"] = "[Mahine1]" + pDs[i][1]
			dataType = pDs[i][2]
			attributes["Tooltip"] = pDs[i][3]
			attributes["Documentation"] = pDs[i][4]
			system.tag.addTag(parentPath=pp,name=tagName,tagType=tagType,dataType=dataType,attributes=attributes)
1 Like

Thanks a lot for your help WildeKurt, but I need to create lots of tag with the associated alarms property and this is not possible with the .csv format ( this is what Ignition wrote on their Manual )

To do a direct import you can’t use a csv but you can set alarm properties through scripting. See system.tag.addTag or system.tag.editTag and system.tag.editAlarmConfig in the docs.

Why don’t you define the alarm on an UDT, and import the tags as UDT members? We always import a list of our devices and have alarms defined on them through UDTs.