Question:
Can I export the current filter list of an E3Alarm in order to print it?
Solution:
Yes, you can export the current filter list of an E3Alarm. To do so, you must first sweep the E3Alarm’s current filter’s events list, and then export them to text or Excel files (or any other accessible format) via Windows system objects with VBScript.
The E3Alarm’s events list works similarly to the object-oriented programming logic in Elipse E3/Power. This list can be accessed via a collection called Events, which is available in E3Alarm. The collection’s Count property returns the number of events in the current filter.
evtcount = Screen.Item("E3Alarm1").Events.Count
Once you have that information, you can then sweep the events list with E3Alarm’s GetEventByIndex method, associated to a repetition loop.
For count = 0 to evtcount - 1 set evtAlarm = Screen.Item("E3Alarm1").GetEventByIndex(count) 'prints the value in InTime field of the retrieved event msgbox "Date/Time (Input) of the retrieved event is: "& evtAlarm.InTime Next
Then, once loading the event object, you can access the values from all fields referring to the alarm. These are Date/Time (Input), Date/Time (Output), Message, Operator, among others. You can find the complete list with all possible fields in an event at Scripts: Reference Manual; the list is at: Visualization – E3Alarm – Events Collection – Event – Properties.
Once you apply the condition loop, you will be able to identify which alarms in the E3Alarm’s alarms list are active.
For count = 0 to evtcount - 1 set evtAlarm = Screen.Item("E3Alarm1").GetEventByIndex(count) If evtAlarm.ConditionActive = "True" Then 'prints the value at InTime field of the retrieved event msgbox "Date/Time (Input) of the retrieved event is: "& evtAlarm.InTime End If Next
The items explained above, as well as the edition of Excel files via VBScript, have inspired the development of the demo application attached to this article.
The related article, How to read/write in Excel files via Elipse E3/Power, shows you in greater details how to manipulate Excel files via an Elipse application.
NOTE: The demo application was developed at Elipse E3 version 5.1 build 186.
Related articles:
- How to read/write in Excel files via Elipse E3/Power.
- KB-31747: Filtering and printing an alarm list.
- KB-12658: Reading/Writing TXT files with E3.