Promotic
WikipediaLinkedInYoutubeTwitterFacebook

ActivateNew - method of the PmaEventGroup object

Description:
The dynamic creation of a new event item (the PmEventItem object) in the active state (red) or the activation of already created item. Method returns the corresponding event item. The reference can be obtained also by calling the Item method.
Syntax:
Object ActivateNew(String sId, String sTemplate, [String sSource], [String sDesc], [String sComment], [Date sTimeOn], [Long nAttr])
Parameters:
sId(String) The unique text identifier of the new event item. This identifier is used for calling methods, for example: Activate, Item, etc.

Caution! for events it is more common not to enter the identifier but to enter an empty string "". This is based on the fact that events usually appear and disappear instanteously (are logged into event history), so no PmEventItem is created in the group.

sTemplate(String) The unique text identifier of an event item of template type (see the "Template for dynamically created items" configurator), whose configuration is used.
sSource[optional] (String) The specification of the source of an event item. It allows the user to sort and filter event items in the viewer in the running application according to the specified source. If not set, then the template value is used.
sDesc[optional] (String) The description itself of the event item. The basic text of the event item that is displayed in the viewer in the running application. If not set, then the template value is used.
sComment[optional] (String) The text comment that is stored into the data together with the activated event item (it is enabled on the "Storage" tab).
sTimeOn[optional] (Date) The activation time of the event item. If not set, then the computer current time is used.
nAttr[optional] (Long) Attributes that make more accurate the behaviour of the command when event item exist/doesn't exist.
0 (default) - When the event item with the specified idenfitier exists, the command makes the activation over the existing event item. When the event item with the specified idenfitier doesn't exist, the command creates a new event item with the activation that follows.
1 - When the event item with the specified idenfitier exists, the command fails. When the event item with the specified idenfitier doesn't exist, the command creates a new event item with the activation that follows.
Return values:
Returns the newly created (or existing) and activated event item (object of the PmEventItem type). In case of an error, it returns the value null for JavaScript or Nothing pro VBScript (probably the event item with the set Id already exists). Nothing value can be tested by VBScript Is operator.
See also:
Example:
JavaScriptVBScriptSelect and copy to clipboard

var oEv = pMe.Pm("/Event");
oEv.ActivateNew("", "HI", "Boiler", "T1 over high limit", "Temperature");
PROMOTIC 9.0.13 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice