Additional Notes:
• You will need to type this into your action patterns.
• Select and Case statements are found under Logic.
• Remember, when you open any IF statement you must always close it with an END IF.
- CLOG{0} = This month
- CLOG{1} = Last month
- EVTYPE = EVENT TYPE
- 1 = Alarm
- 0 = Signal
- 9 = Ignored Signal
• {ME} = The current customer account.
• STCODE = The output event code in the customer activity log.
• {DU} = Event Date/Event UTC Date/Time
- HH = Hours
• All Script messages (items with the curly brackets) are available in the Quick Reference guide called Script Messages.
SELECT (SELECT COUNT(*) FROM CLOG{0} WHERE STCODE = “AT” AND EVTYPE = 1 AND SERIALNO={ME} AND LOGDATE >= DATEADD(HH,-4, “{DU}”))+(SELECT COUNT(*) FROM CLOG{1} WHERE STCODE = “AT” AND EVTYPE = 1 AND SERIALNO={ME} AND LOGDATE >= DATEADD(HH,-4, “{DU}”))
Reading this in plain language, this reads:
Select a count from this month’s customer log where the output event code is AT and the event type is an alarm and the customer record is this customer record and the log date is in the last four hours from the time of this alarm, PLUS select a count of the alarms from last month’s customer log where the output event code was AT and the event type was alarm and the customer record is this customer record and the log date is in the last four ours from the time of this alarm.
Combined this query collects the total amount of alarms received in the last four hours for this account that are of the type of AT in the customer activity log.