Promotic
WikipediaLinkedInYoutubeTwitterFacebook

GetHistoryData - method of object PmAlarmEvent

Description:
Getting the data from history of alarms/events that fit the specified filtering text.
Syntax:
GetHistoryData(sColumns As String, sFilter As String) As Array
Calling:
a = oAlEv.GetHistoryData(sColumns, sFilter)
Parameters:
sColumns(String) Identificators list of desired columns (properties) of alarm/event items, separated by comma (,), for example "Desc,TimeOn,TimeOff,TimeAck".
"TimeOn" - Activation time
"TimeOff" - Inactivation time
"TimeAck" - Acknowledge time
"GlobalId" - Identifier of alarm/event item in group
"Priority" - Priority of alarm/event item
0 - low
5 - medium
10 - high
"Area" - Marking area of alarm/event item
"Source" - Marking source of alarm/event item
"Desc" - Alarm/Event item description
"Comment" - Alarm/event item comment
"UserNote" - Alarm/event item user note
"AckerId" - Identification of the user making alarm acknowledgement
sFilter(String) Filtering text that specifies which alarms/events are to be included into the desired output.

Different filtration fields can be used simultaneously, the alarm/event then must comply with all of them (e.g. "desc:FIQ100;priority.ge:5;").

The filtering text xx cannot be empty (e.g. it is not possible to enter "desc:;").

Entries with assigned value are separated by a semicolon, for example "desc:Test2;records:50;".
 

The folowing types of filtration texts exist (where "field" represents some of the alarm columns):

"field:xx;" means that the corresponding alarm field must be equal to the value of xx.
"field:#eq:xx;" means that the corresponding alarm field must be equal to the text xx. If the corresponding alarm field is to be equal to one of several texts, it is possible to enter multiple texts separated by #or: (OR operator).
"field:#begin:xx;" means that the corresponding alarm field must begin with the text xx. If the corresponding alarm field is to begin with some of several texts, it is possible to enter multiple texts separated by #or: (OR operator).
"field:#in:xx;" means that the corresponding alarm field must contain the textxx. If the corresponding alarm field is to contain some of several texts, it is possible to enter multiple texts separated by #or: (OR opertor).
"field:#le:xx;" means that the corresponding alarm field must be less or equal to xx.
"field:#ge:xx;" means that the corresponding alarm field must be greater or equal to xx.
 
Note! If the field begins with the text s., then this is the setting hidden from the enduser in the alarm/event viewer and it is used to set the definite script filtration independent on end user settings. Both filtration type fields can be used for a single column simultaneously. In order to let the alarm/event pass the filter it must comly to both filtering fields. This can be handy for definite script filtrations (independent on enduser) and also for setting the initial state of user defined filtration (that can be modified by the enduser). For example s.source:#begin:Boiler;source:Boiler1;.
 
"area:#oper:xx;" (optional) - Show alarms with area observing the defined operation #oper:xx. The part of filter dependent on user setting in the alarm/event viewer. For example "area:BoilerPlant1;" or "area:#eq:BoilerPlant1;" or "area:#eq:BoilerPlant1#or:BoilerPlant2;" or "area:#begin:BoilerPlant;".
"s.area:#oper:xx;" (optional) - Show alarms with area observing the defined operation #oper:xx. The part of filter hidden from the user in the alarm/event viewer. For example "s.area:BoilerPlant1;" or "s.area:#eq:BoilerPlant1;" or "s.area:#eq:BoilerPlant1#or:BoilerPlant2;" or "s.area:#begin:BoilerPlant;".
"source:#oper:xx;" (optional) - Show alarms with source observing the defined operation #oper:xx. The part of filter dependent on user setting in the alarm/event viewer. For example "source:Boiler;" or "source:#eq:Boiler;" or "source:#eq:Boiler1#or:Boiler2;" or "source:#begin:Boiler;".
"s.source:#oper:xx;" (optional) - Show alarms with source observing the defined operation #oper:xx. The part of filter hidden from the user in the alarm/event viewer. For example "s.source:Boiler;" or "s.source:#eq:Boiler;" or "s.source:#eq:Boiler1#or:Boiler2;" or "s.source:#begin:Boiler;".
"desc:#oper:xx;" (optional) - Show alarms with description (desc) observing the defined operation #oper:xx. The part of filter dependent on user setting in the alarm/event viewer. For example "desc:FIQ101;" or "desc:#eq:FIQ101;" or "desc:#eq:FIQ101#or:FIQ102;" or "desc:#begin:FIQ;".
"s.desc:#oper:xx;" (optional) - Show alarms with description (desc) observing the defined operation #oper:xx. The part of filter hidden from the user in the alarm/event viewer. For example "s.desc:FIQ101;" or "s.desc:#eq:FIQ101;" or "s.desc:#eq:FIQ101#or:FIQ102;" or "s.desc:#begin:FIQ;".
"comment:#oper:xx;" (optional) - Show alarms with comment observing the defined operation #oper:xx. The part of filter dependent on user setting in the alarm/event viewer. For example "comment:correction;" or "comment:#eq:correction;" or "comment:#eq:correction#or:test;" or "comment:#begin:correction;".
"s.comment:#oper:xx;" (optional) - Show alarms with comment observing the defined operation #oper:xx. The part of filter hidden from the user in the alarm/event viewer. For example "s.comment:correction;" or "s.comment:#eq:correction;" or "s.comment:#eq:correction#or:test;" or "s.comment:#begin:correction;".
"priority:#oper:xx;" (optional) - Display alarms whose priority complies with the iperation #oper:xx. The part of filter dependent on user setting in the alarm/event viewer. For example "priority:5;" or "priority:#eq:5;" or "priority:#le:5;" or "priority:#ge:5;".
"from:xx;" (optional) - Display the alarms with time of creation (timeon) greater or equal to time "xx". The time is entered as time(YYYY.MM.DD-hh:mm:ss.mmm), e.g. from:time(2016.07.28-14:30:00.000); The time interval allows to narrow down the searched alarm set (the alarms outside the time interval are not tested).
"to:xx;" (optional) - Display the alarms with time of creation (timeon) less or equal to time "xx". The time is entered as time(YYYY.MM.DD-hh:mm:ss.mmm), e.g. from:time(2016.07.28-15:00:00.000); The to time can also be entered by the now keyword, which means the current time (at the moment of calling), e.g. to:now. The time interval allows to narrow down the searched alarm set (the alarms outside the time interval are not tested).
"timerange:xx;" (optional) - Display the alarms with the creation time (timeon) belonging to specified time interval For selecting the time interval by timerange, the value of from or to must be defied, then the timerange allows to compute the missing limit of the time interval. Thus the time interval can be defined by the following pairs: from - to, from - timerange or to - timerange. For example to:now;timerange:30m;. The time interval allows to reduce the portion of alarm items to be searched (the alarm items outside the time interval are not tested).

The time span can be entered as whole number followed by time unit sign (without space). Valid time units are: w = week, d = day, h = hour, m = minute, s = second. For example timerange:12h; or timerange:90m;.

"records:xx;" (optional) - Allows to define (reduce) the number of desired alarms, satisfying the filter criteria. The alarm search is terminated after the number of found items reaches the defined count. Together with the time interval limitation the alarms can also be limited to a certain portion. Using the normal filter would make the search go through all the alarm items including the backup records. It is therefore handy to limit the fiters in order to search only the desired portion of alarm history.
"scanrecords:xx;" (optional) - It allows to set (reduce) the number of all tested (browsed) alarms, disregarding whether the alarms meet the filter criteria or not. After the number of tested alrms reaches the defined value the testing is terminated. This setting allows to prevent the system from searching within too many items in history if the number of desired search results is not reached. Together with the time interval reduction it allows to reduce the portion of alarms to be searched. The normal filter would cause the system to search through all alarms in all backups. It is therefore handy to limit the fiters in order to search only the desired portion of alarm history.
"scanstart:xx;" (optional) - It allows to change the default direction of alarm searching (where the search begins). It is defined as scanstart:from; or scanstart:to;. If the time interval is not defined or only to is defined (can be set together with from or with timerange), then the default search direction is from newer to older items. If only from is defined (can be set together with timerange), then the default search direction is from older to newer items. Using the scanstart is handy particulary if the time interval is defined by from and to and it is needed to change the search direction from older to newer items (scanstart:start;).
"lang:xx;" (optional) - Defines the language to be used for evaluated localised texts. Language is determined with a text identifier, e.g. "en", "de", "ru" etc. - see Fully supported languages in the PROMOTIC system. If not defined, the language currently used in the application will be used - therefore it is not necessary to define this under normal circumstances. See the configurator "Main language of runtime".
"headers:xx;" (optional) - Defines whether the output list will contain (on the first or/and second row) also the localised column names while being viewed.
title - The first/second row of the output list will contain the localised column names while being viewed.
id - The first/second row of the output list will contain the system column names (identifiers) while being viewed.
Note:
The implementation of alarm/event filters tends to search and test all alarm/event items available in history. In order to prevent searching all items, it is necessary to reduce the query (filter criteria) to a smaller portion of alarm/event items. The reduction can be based on a time interval, causing the search focuses only on items belonging to the defined time interval. Another reduction possibility is to define the total number of alarm/event items to be found and also the total searched alarm/event items count can be defined. For the reduced portion of alarm/event items to be searched also a search direction (scanstart) can be specified, athough the search results are sorted the same way. Changing the search direction is relevant only if complemented with reduction of searched items count (scanrecords) or found (records) items count. In such case the search direction is relevant because it sets the side of the time interval that can be omited based on the item limitation.
Example1:
Get the last (newest) 50 alarms records:50;scanrecords:500; (the values of desired columns), satisfying the filter condition (desc:Test2;).
a = oAlEv.GetHistoryData("Desc,TimeOn,TimeOff,TimeAck", "desc:Test2;records:50;scanrecords:500;")
Example2:
Getting all alarms (values of desired columns), meeting the filtering criteria (desc:Test2;) in last 8 hours (timerange:8h;) regarding the defined time (to:time(2016-07-20_06:00:00.000);) and with count limitation of maximum searched and returned sentences records:50;scanrecords:500;. Get also the english column names in the first row.
a = oAlEv.GetHistoryData("Desc,TimeOn,TimeOff,TimeAck", "desc:Test2;to:time(2016-07-20_06:00:00.000);timerange:8h;records:50;scanrecords:500;lang:en;headers:title;")
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice