Hello all,
I'm trying to count the total number of active and unacknowledged alarms. I can generate the list of alarms in the Alarm Screen, but I can't seem to figure out how to Query the Raima DB for the alarm history in my scripts. Is there a specific config that I could do a dpQuery or dpGet on?
How to Sum the total number of unacknowledged alarms?
- vince2e
- Posts:39
- Joined: Tue Aug 02, 2016 4:19 pm
How to Sum the total number of unacknowledged alarms?
- vince2e
- Posts:39
- Joined: Tue Aug 02, 2016 4:19 pm
Re: How to Sum the total number of unacknowledged alarms?
Forget the question above. I was able to figure it out with help from the SQL query builder & the help manual.
Here are the scripts I'm using to get alert info.
//Historical Alert Info
//string query = "SELECT ALERT '_alert_hdl.._(ENTER CONFIG)' FROM '(ENTER DP_NAME)'";
string query = "SELECT ALERT '_alert_hdl.._value', '_alert_hdl.._prior', '_alert_hdl.._text', '_alert_hdl.._act_text' FROM 'F-1504'";
dpQuery(query, Result);
DebugN(Result);
//Current Alert Info
dpGet("System1:F-1504.Temperature.HiTemp.Status.L1:_alert_hdl.._act_state", Test3);
DebugN("This is the alert State "+Test3);
Here are the scripts I'm using to get alert info.
//Historical Alert Info
//string query = "SELECT ALERT '_alert_hdl.._(ENTER CONFIG)' FROM '(ENTER DP_NAME)'";
string query = "SELECT ALERT '_alert_hdl.._value', '_alert_hdl.._prior', '_alert_hdl.._text', '_alert_hdl.._act_text' FROM 'F-1504'";
dpQuery(query, Result);
DebugN(Result);
//Current Alert Info
dpGet("System1:F-1504.Temperature.HiTemp.Status.L1:_alert_hdl.._act_state", Test3);
DebugN("This is the alert State "+Test3);
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to Sum the total number of unacknowledged alarms?
If you want to get only the alerts which can be acknowledged you can extend the query with a WHERE condition.
E.g. you can use the attribute _ackable in the condition WHERE '_alert_hdl.._ackable' == 1
Best Regards
Leopold Knipp
Senior Support Specialist
E.g. you can use the attribute _ackable in the condition WHERE '_alert_hdl.._ackable' == 1
Best Regards
Leopold Knipp
Senior Support Specialist
- vince2e
- Posts:39
- Joined: Tue Aug 02, 2016 4:19 pm
Re: How to Sum the total number of unacknowledged alarms?
Thanks Leopold,
That is a good option. Is there anyway I could filter all of my DPEs under a system name? Currently, I have to use multiple patterns such as "System1:*.*:_alert_hdl" or "System1:*.*.*:_alert_hdl". I would like to use something more generic like as "System1:*_alert_hdl", but that doesn't work.
That is a good option. Is there anyway I could filter all of my DPEs under a system name? Currently, I have to use multiple patterns such as "System1:*.*:_alert_hdl" or "System1:*.*.*:_alert_hdl". I would like to use something more generic like as "System1:*_alert_hdl", but that doesn't work.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to Sum the total number of unacknowledged alarms?
If you want to filter data for a specific system name you have to use the REMOTE keyword.
Using the systemname in the SELECT or FROM statement is not supported.
For detailed information please have a look at the WinCC OA documentation: System management --> Reporting --> SQL.
Best Regards
Leopold Knipp
Senior Support Specialist
Using the systemname in the SELECT or FROM statement is not supported.
For detailed information please have a look at the WinCC OA documentation: System management --> Reporting --> SQL.
Best Regards
Leopold Knipp
Senior Support Specialist
- Gertjan van Schijndel
- Posts:634
- Joined: Mon Aug 02, 2010 10:37 am
Re: How to Sum the total number of unacknowledged alarms?
You can use the pattern '*.**' to get all datapoint elements in a system.
- leoknipp
- Posts:2928
- Joined: Tue Aug 24, 2010 7:28 pm
Re: How to Sum the total number of unacknowledged alarms?
If you want to get all dp elements for a system in a query the FROM clause can be '*'.
There is no need to add another or different wildcard pattern.
Best Regards
Leopold Knipp
Senior Support Specialist
There is no need to add another or different wildcard pattern.
Best Regards
Leopold Knipp
Senior Support Specialist