Promotic

Opening the viewer of the PmaAlarmGroup object

The viewer of this object is opened by by the Pm.CreateView method, where in the sViewPath parameter the path to this object is entered.

The PmaAlarmGroup object in fact implements two viewers:
- /#state : (Default) Alarm state viewer.
- /#history : Alarm history viewer.


The states and history viewers are represented by two preconfigured panels PmaPanel. These panels are registered in the PmaAlarmGroup object.
When the viewer of the PmaAlarmGroup object is being opened, the system redirects to corresponding registered panel. See Viewing alarms/events.
Syntax:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(oFrom, sViewPath, sViewPars, sFramePars);
oCreator.Open();
Viewer parameters:
oFrom(Object) The object, which will mediate the opening of the viewer.
The object specifies the origin of the path, the relative position of the window, the parent, etc..
- The null value means the usage of:
- the PmaPanel object if the CreateView method is called in the script of the Pmg object.
- active PmaWorkspace, if the CreateView method is called in the script of the Pma object.
- If the the PmgFrame object is entered here (in the script of the Pmg object), then the viewer opens in this frame.
- If the the PmaPanel object is entered here (in the script of the Pma object), then the viewer opens in this selected object.

See the PmViewCreator.From property.
sViewPath(String) Path (relative or absolute) to the object or component whose viewer will be opened.
See the PmViewCreator.ViewPath property.
sViewPars(String) Viewer parameters (they differ for various viewer types)
Entries are in the KeyVal format, for example "name1:value1;name2:value2;".
See the PmViewCreator.View property.

Viewer parameters:
pars[optional] (PmMap) The viewer is in fact a preconfigured panel PmaPanel, therefore all the viewer parameters are contained in the pars parameter. The preconfigured panel PmaPanel of the states or history viewer uses the following parameters.
filter (optional) - Filtering string in the KeyVal format.
If not defined then all items of the group will be displayed.
In order to easily create/set an embedded map (Submap) in another map's item the PmMap.mapSetSubmapAt method can be used. This method creation of the submap in the item and can add multiple items from a string in the KeyVal format.
grouppath (optional) - Path to the PmaAlarmGroup object.
If the path is not defined then this parameter is added during opening while redirecting from the alarm group to the registered viewer panel.
statepath (optional) - Path to registered panel of the alarm state viewer. The parameter allows switching the history viewer to the status viewer.
If the path is not defined then this parameter is added during opening while redirecting from the alarm group to the registered viewer panel.
historypath (optional) - Path to registered panel of the alarm history viewer. The parameter allows switching the status viewer to the history viewer.
If the path is not defined then this parameter is added during opening while redirecting from the alarm group to the registered viewer panel.
Arguments[optional] (Variant) () Value passed to the panel viewer that is being opened. It can be a simple value (Integer, String, ...), array or object of the PmArray or PmMap type (it is not recommended to transfer objects of other types here).
This value is then available:
- in the onOpen event
- in the PmaPanel object by means of the PmgRoot.Arguments property
onOpen[optional] (Function) The event function for managing the event of viewer opening.
For JavaScript the function is entered.
For VBScript the PmAction object is entered.
 
The function has a single parameter ev containing information regarding the corresponding event.
ev.Arguments - (Variant) Input value of the viewer. See Arguments.
onClose[optional] (Function) The event function for managing the event of viewer closing.
For JavaScript the function is entered.
For VBScript the PmAction object is entered.
 
The function has a single parameter ev containing information regarding the corresponding event.
ev.CloseReason - (String) Identifier of the window closing type. See the sReason parameter in the PmgRoot.Close method.
ev.ReturnValue - (Variant) Output value of the viewer. See the PmgRoot.ReturnValue property.
sFramePars(String) Parameters for the frame where the viewer will be displayed
Entries are in the KeyVal format, for example "target:_blank;".
See the PmViewCreator.Frame property.
The viewer parameters are in the form of the PmMap object that is filled from value of the sViewPars parameter (of the KeyVal type) in the Pm.CreateView method.
By filling from the KeyVal value all the parameters are initially stored as string. The content of the PmMap object can be then modified as needed - items can be modified, added and deleted.
The PmMap object can also contain other embedded PmMap objects (Submap). The PmMap.mapSetSubmapAt method can be used in order to create a new PmMap or make one accessible.
Example1:
Opening the viewer of the alarm states (with default setting) in a named separate window
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/Alarms/#state", "", "target:_blank.alarms");
oCreator.Open();


Example2:
Opening the viewer of the alarm history with passed filtering parameter in a named separate window
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/Alarms/#history", "pars:{filter:{source:#eq:Boil;}};", "target:_blank.alarms");
oCreator.Open();
or by mapSetSubmapAt as follows:
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "/Alarms/#history", "", "target:_blank.alarms");
oCreator.View.mapSetSubmapAt("pars", "", "filter:{source:#eq:Boil;}");
oCreator.Open();


Example3:
Opening the viewer the panel with the viewer of the alarm history with passed path to grouppath and statepath
JavaScriptVBScriptSelect and copy to clipboard

var oCreator = Pm.CreateView(null, "../AlarmHistory", "pars:{grouppath:../Alarms;statepath:../AlarmsState};", "target:_blank.alarms");
oCreator.Open();

History:
Pm9.00.09: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.