Pmlevents User Manual: Addin To Aveva Applications Enabling Event Handling Through PML Functions
Pmlevents User Manual: Addin To Aveva Applications Enabling Event Handling Through PML Functions
Pmlevents User Manual: Addin To Aveva Applications Enabling Event Handling Through PML Functions
Olivier Ercilbengoa
Version 1.4
10 May 2016
1
Table of Contents
1. Introduction..........................................................................................................................................3
2. Installation............................................................................................................................................3
5. Limitation.............................................................................................................................................6
6. Example................................................................................................................................................7
2
3
Introduction
PMLEvents is an Addin to AVEVA applications that enables the use of PDMS database events from PML
language. User can attach PML functions to database events differentiating on element type and
attribute type.
1. Installation
To install PMLEvents, you can refer to ‘Configuring a Module to Load an Addin’ in the Chapter ‘How to
Write a CAF Addin’ located in ‘User Guide .NET Customisation’.
4
2. XML settings file syntax
The Addin is controlled by PMLEvents.xml settings file placed in the <proj>DFLTS\Common\ folder.
The path PDMSDFLTS\Common\ is also checked for existence of this file if not found in project specific
defaults.
Example path:
c:\AVEVA\Plant\Projects12.1.SP2\Sample\samdflts\Common\PMLEvents.xml
o PDMSTYPE could be a standard PDMS type or a UDET. If it is a standard PDMS type, the
event will not be triggered on UDET with this PDMSTYPE as base type.
5
o No PDMSTYPE has to be specified for SAVEWORK EVENT.
o PDMSTYPE is optional for CHANGE EVENT. If none is specified then the event will be
fired for any PDMS element type or UDET owning ATTNAME attribute.
ATTNAME node defines PDMS attribute or UDA name for which event is handled in a content
string.
o Special string ALLATT given as content string marks, that the event will be applied on any
standard PDMS attribute.
o Special string ALLUDA given as content string marks, that the event will be applied on
any UDA.
o Special string ALL given as content string marks, that the event will be applied on any
UDA and standard PDMS attribute.
o PARAM node for each parameter that should be passed to the function
Real value given here can be passed as string or as real depending on requested
parameter type.
Special string DBELEMENT given as value marks, that at this parameter the
database element is passed to PML. It can be passed as dbref or string,
depending on requested parameter type.
Special string OLDVALUE given as value in CHANGE event marks, that at this
parameter the old value of the attribute is passed to PML. type declaration is
not required in this case because old value will always be of attribute type.
Special string ATTNAME given as value in CHANGE event marks, that at this
parameter the name of the attribute is passed to PML. type declaration has to
be string.
PMLALLOWCHECK node can be used with DELETE event. It defines the function that is called to
check if element can be deleted. Function is expected to return BOOLEAN result and is always
given a DBREF of element as a parameter.
6
Note that if PMLALLOWCHECK function return FALSE while running with element, no call to
PMLFUNC defined for this event and this element will be performed (because delete action is
not finalized).
PMLEvents could be de-activated during the session by setting or modifying the global PML string
variable !!PMLEVENTS.
It could be usefull inside PMLfunction triggered to prevents infinite loop or recursive calls.
4. Limitation
<EVENT>
<EVENTTYPE>MOVE</EVENTTYPE>
<PDMSTYPE>:MECHTAG</PDMSTYPE>
<PDMSTYPE>ENGITE</PDMSTYPE>
<PMLFUNC name="PMLEventMove">
<PARAM type="dbref">DBELEMENT</PARAM>
</PMLFUNC>
</EVENT>
On MOVE event, if UDET and BASETYPE is assigned, the event is triggered twice when triggered on UDET.
7
5. Example
8
<PARAM type="string">ATTNAME</PARAM>
<PARAM type="string">CENTRI</PARAM>
</PMLFUNC>
</EVENT>
<EVENT>
<EVENTTYPE>CHANGE</EVENTTYPE>
<PDMSTYPE>:ELECTAG</PDMSTYPE>
<ATTNAME>ALLUDA</ATTNAME>
<PMLFUNC name="PMLEventChange">
<PARAM type="dbref">DBELEMENT</PARAM>
<PARAM>OLDVALUE</PARAM>
<PARAM type="string">ATTNAME</PARAM>
<PARAM type="string">ELEC</PARAM>
</PMLFUNC>
</EVENT>
<EVENT>
<EVENTTYPE>CHANGE</EVENTTYPE>
<PDMSTYPE>ENGITE</PDMSTYPE>
<ATTNAME>DESC</ATTNAME>
<PMLFUNC name="PMLEventChange">
<PARAM type="dbref">DBELEMENT</PARAM>
<PARAM>OLDVALUE</PARAM>
<PARAM type="string">ATTNAME</PARAM>
<PARAM type="string">ENGITE</PARAM>
</PMLFUNC>
</EVENT>
<!-- Delete Events -->
<EVENT>
<EVENTTYPE>DELETE</EVENTTYPE>
<PDMSTYPE>ENGITE</PDMSTYPE>
<PMLFUNC name="PMLEventDelete">
<PARAM type="dbref">DBELEMENT</PARAM>
<PARAM type="string">MyTextENGITE</PARAM>
</PMLFUNC>
<PMLALLOWCHECK>PMLEventDeleteCheck</PMLALLOWCHECK>
</EVENT>
<EVENT>
<EVENTTYPE>DELETE</EVENTTYPE>
<PDMSTYPE>:MECHTAG</PDMSTYPE>
<PMLFUNC name="PMLEventDelete">
<PARAM type="dbref">DBELEMENT</PARAM>
<PARAM type="string">MyTextMECHTAG</PARAM>
<PMLALLOWCHECK>PMLEventDeleteCheck</PMLALLOWCHECK>
</PMLFUNC>
</EVENT>
<!-- Claim Events -->
<EVENT>
<EVENTTYPE>CLAIM</EVENTTYPE>
<PDMSTYPE>ENGITE</PDMSTYPE>
<PDMSTYPE>:MECHTAG</PDMSTYPE>
<PMLFUNC name="PMLEventClaim">
<PARAM type="dbref">DBELEMENT</PARAM>
</PMLFUNC>
</EVENT>
<!-- Savework Events -->
<EVENT>
<EVENTTYPE>SAVEWORK</EVENTTYPE>
<PDMSTYPE>:MECHTAG</PDMSTYPE>
<PMLFUNC name="PMLEventSavework">
9
</PMLFUNC>
</EVENT>
</EVENTLIST>
10
5.2. PML function files
5.2.1. PMLEventChange.pmlfnc
define function !!PMLEventChange(!DbRef is DBREF, !OldValue is ANY, !AttName is STRING, !Comment is
STRING)
$p PMLEventChange $!Dbref.name $!OldValue $!AttName $!Comment
return
endfunction
5.2.2. PMLEventClaim.pmlfnc
define function !!PMLEventClaim( !DbRef is DBREF)
$p PMLEventClaim $!DbRef.name
return
endfunction
5.2.3. PMLEventCreate.pmlfnc
define function !!PMLEventCreate( !DbRef is DBREF, !MyText is STRING)
$p PMLEventCreate $!DbRef.name $!mYText
return
endfunction
5.2.4. PMLEventDelete.pmlfnc
define function !!PMLEventDelete( !DbRef is DBREF, !MyText is STRING)
$p PMLEventDelete $!DbRef.name $!MyText
return
endfunction
11
5.2.5. PMLEventDeleteCheck.pmlfnc
define function !!PMLEventDeleteCheck( !DbRef is DBREF) is BOOLEAN
$p PMLEventDeleteCheck $!DbRef.name
return true
endfunction
5.2.6. PMLEventMove.pmlfnc
define function !!PMLEventMove( !DbRef is DBREF)
$p PMLEventMove $!DbRef.name
return
endfunction
5.2.7. PMLEventSavework.pmlfnc
define function !!PMLEventSavework()
$p PMLEventSavework
return
endfunction
12