# SQLTags Alarm Edit

**URL:** <https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092>\
**Category:** Ignition\
**Created:** [March 24, 2013, 11:57am UTC](https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092 "2013-03-24T11:57:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [March 24, 2013, 11:57am UTC](https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092/1 "2013-03-24T11:57:02Z")

</div>

I’ve downloaded from Extras and tested the “SQLTags Alarm Edit” window for Ignition.  
I have found two ‘bugs’:

1. In the table ‘Tags’ the Data property has query:

`SELECT 
 c.id,
 c.path,
 c.name,
 m.intval as alerttype
FROM 
 sqlt_core c, sqlt_meta m
WHERE 
 m.tagid = c.id AND AND c.tagtype IN (0,1,2) AND m.name = 'alertmode' AND m.intval > 0
ORDER BY 
 c.path ASC, c.name ASC`

I found that the m.name should be ‘AlertMode’ (field name in sqlt\_as table) and “c.deleted = 0 AND” must be added (to get the right tags):

`SELECT 
 c.id,
 c.path,
 c.name,
 m.intval as alerttype
FROM 
 sqlt_core c, sqlt_meta m
WHERE 
 m.tagid = c.id AND c.deleted = 0 AND c.tagtype IN (0,1,2) AND m.name = 'AlertMode' AND m.intval > 0
ORDER BY 
 c.path ASC, c.name ASC`

in order to work.

1. When you change some properties in ‘Digital Settings’ and click ‘Save’ button, the TimeDeadBand and TimeDeadBandUnits are not saved (because they are not in the script for Save button). When you select the tag again in ‘Tags’ table, you see ‘0’ (zero) and in TimeDeadBand and TimeDeadBandUnits controls (because in the sqlt\_as table there are 0 and null). [code]alertName = event.source.parent.getComponent(‘AlertName’).text severity = event.source.parent.getComponent(‘Severity’).selectedValue equalTo = event.source.parent.getComponent(‘AlertType’).getComponent(‘EqualTo’).selected notEqualTo = event.source.parent.getComponent(‘AlertType’).getComponent(‘NotEqualTo’).selected anyChange = event.source.parent.getComponent(‘AlertType’).getComponent(‘AnyChange’).selected value0 = event.source.parent.getComponent(‘Value0’).selected value1 = event.source.parent.getComponent(‘Value1’).selected valueOther = event.source.parent.getComponent(‘ValueOther’).selected otherValue = event.source.parent.getComponent(‘OtherValue’).intValue #!!!No TimeDeadBand and no TimeDeadBandUnits!!! tagID = event.source.parent.parent.getComponent(‘AvailableTags’).getComponent(‘Tags’).selectedTagID fpmi.db.runUpdateQuery(“DELETE FROM sqlt\_as WHERE tagid = %d” % (tagID)) query = “INSERT INTO sqlt\_as (tagid, statename, severity, low, high, flags) VALUES (?,?,?,?,?,?)” if anyChange: fpmi.db.runPrepStmt(query, [tagID, alertName, severity, 0, 1, 26]) else: if value0: value = 0 elif value1: value = 1 else: value = otherValue if equalTo: fpmi.db.runPrepStmt(query, [tagID, alertName, severity, value, value, 0]) else: fpmi.db.runPrepStmt(query, [tagID, alertName, severity, 0, value, 6]) fpmi.db.runPrepStmt(query, [tagID, alertName, severity, value, 1, 9]) fpmi.db.runUpdateQuery(“UPDATE sqlt\_core SET configchange = CURRENT\_TIMESTAMP WHERE ID = %d” % tagID)[/code] Can this be corrected for future downloads? Another thing: Could this ‘goodie’ be upgraded so that we can also add new tags with alarms? In my experience there is also much need to add new alarms as change the existing ones (if not more).

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 27, 2013, 3:48pm UTC](https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092/2 "2013-03-27T15:48:13Z")

</div>

Thanks for brining that up to our attention. We are planning on recreating this goodie using some built-in functions. Those screens only work for tags stored in an external provider. We want to make this work for any tags regardless of where they are stored.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [March 27, 2013, 7:19pm UTC](https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092/3 "2013-03-27T19:19:00Z")

</div>

Thank you for answering.

That’s really a good idea. ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")  
Looking forward to it.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [January 27, 2017, 10:23am UTC](https://forum.inductiveautomation.com/t/sqltags-alarm-edit/6092/4 "2017-01-27T10:23:53Z")

</div>

I just revisited this and after 4 years nothing has changed… 😒 ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")
