You are on page 1of 28

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

PML Quick tips and tricks


Learning how to create small codes to extract great results

Session ID: EPC-28

Presented by: Thiago Oliveira, Latin America Technical Manager

November 14th 2019

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Introduction
Basic Commands in PML 1
TTY Mode (non graphics)
PMLLIB / PMLUI / MACROS Area
PML Code Types
Codes Examples
Menu Additions

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Introduction

• PML Language – Used in Dabacon Products


• PML 1
• Macros and simple commands

• PML 2
• More structured codes (objects, forms, functions)
• PMLLIB Folder

• PML.NET
• More complex and powerful codes

• Integration with .NET Platform

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Basics Commands in PML 1

Claim / Unclaim
– Required to change elements in Dabacon DBs
– Implicit / Explicit Claimlist Databases
– Unclaiming Elements
– Claim by “Dead” users

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Basics Commands in PML 1

Claim / Unclaim
– Syntax
• 1st part: Action CLAIM / UNCLAIM
• 2nd part: Action Element Ce / “type” / next / prev / last
• 3rd part: Element Hierarchy or Members Hier / mem
• Ex: claim ce hier
• Ex: unclaim pipe mem
• Ex: claim bran

Help pml: $q
– Ex.: claim $q

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Basics Commands in PML 1

New / Delete
– Sintaxe:

• 1st part: Action NEW / DELETE

• 2nd part: Element Type “type”

– Ex: new PIPE

– Ex: delete STRU

- Ex: new SITE /My-Site

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Basics Commands in PML 1
Collections
– Syntax:
• 1st component: PML Variable → var !varName
• 2nd component: Action → COLLECT / APPEND COLLECT
• 3rd component: What to collect → “TYPE” / (“TYPE1” “TYPE2” ...)
• 4th component: Filter → PML
– Main Filters: » Text: matchwild / occurs / etc
» Attributes: pa pos / pl bore / hei / etc

– Operators: » Bigger than: gt » Bigger or Equal: ge


» Less than: lt » Less or Equal: le
» Equal: eq » Different: ne

• 5ª component: Where to collect → for ce / for site / for /SiteName / etc

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Basics Commands in PML 1
Collections
– Examples:

• Var !pipeSites collect all site with matchwild(name,’*PIPING’)

• Var !pipeSites coll all site with purpose eq ‘PIPE’

• Var !membersAaSpec coll all bran mem with matchwild(name of spec of spref,’*Aa*’) for pipe

• Var !equi coll all equi with :idStatus gt 1 for /Equipments

• Var !WorldbranMem coll all bran mem

• Var !allElements coll all


© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
Basics Commands in PML 1
Collections
– Examples:

• Var !pipeElem collect all with matchwild(name,’*PIPING’) and type eq ‘PIPE’

• Var !pipeElem coll all PIPE with matchwild(name,’*PIPING’)

• Var !pipeElem coll all PIPE with matchwild(name,’*PIPING’) for /SITE1 /SITE2

Time consuming!!
Queries from Collections: Q VAR !pipeElem

Evaluating Collection Arrays: Var !pipeElemName eval name for all from !pipeElem
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
TTY Mode
> Faster (much faster!!)
> used in Batch call or CMD
> Doesn’t support graphical interface:
Need to consider the use of
– Forms
HANDLE/ENDHANDLE
–“!!alert.” commands:
statements!
• !!alert.message()
• !!alert.error() !!alert.message(‘Message to User’)

• !!alert.warning() Handle any

• !!alert.input() -- to handle TTY mode execution

• etc endhandle

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


TTY Mode
Sintaxe
– 1st component: batch call to access PDMS/E3D/Engineering etc
call “batchFilePath.bat”
– 2nd component: TTY mode
– 3rd component: Project
– 4th component: USER/PASSWORD
– 5th component: /MDB
– 6th component: $M “macro”
– Ex:
set dir="C:\Program Files (x86)\AVEVA\Administration1.6.0\admin.bat"

call %dir% tty APS SYSTEM/XXXXXX /ALL


$m/D:\BASE_DE_CUSTOMIZACOES\PML\AVEVA\admin\macroTTY_Example.pmlmac
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
TTY Mode
PDMSWait Feature

➢ Call Several macros in a single batch file

➢ Sort many macros calls in a single batch file

➢ Enable that a specific routine starts its execution only by the conclusion of a

preliminary routine

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


TTY Mode
PDMSWait Feature - Syntax

➢ Required Environment Variable: PDMS_CONSOLE_IDENTIFIER como %RANDOM%

➢ In the macro following blank line, add the PDMSWait call:

➢ call C:\Program Files (x86)\AVEVA\Everything3D2.10\PDMSWait

PDMSWait Feature – Examples

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


TTY Mode
PDMSWait Feature – Examples

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


TTY Mode
PDMSWait Feature – Examples

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PMLLIB / PMLUI / Macro Areas
• PMLLIB → set of macros, pml objects, pml functions and pml forms (PML 2)
• PDMSUI → set of macros and PML 1 objects that build menus in many
modules for Dabacon applications
• It is possible to set several PMLLIBs e PDMSUIs
– Ex: Set PMLLIB=address1 address2 etc

• PML.INDEX
• PML REHASH ALL
• Q EVAR PMLLIB
• Q EVAR PMLUI
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PML Code Types
• Macros
▪ Are not required to be in PMLLIB or PMLUI
▪ Normally make the link between the user and complex codes
▪ Script structure
▪ Call Syntax: $m macroAddress
▪ File Extension: none (but it is a good practice to use .pmlmac)
▪ It can receive parameters:
▪ $m macroAddress parameter1 parameter2 etc
▪ Inside the macro it is possible to receive the input parameters
▪ !para1 = $1
▪ !para2 = $2

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PML Code Types
• Functions
▪ Are required to be in PMLLIB or PMLUI
▪ Have a more organized structure of receiving and generating parameters
▪ General Format

define function !!functionName()


CODE
endfunction

▪ Call Syntax: !!functionName()


▪ File Extension: .pmlfnc

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PML Code Types
• Objects
▪ Are required to be in PMLLIB or PMLUI
▪ Have a more organized structure of receiving and generating parameters and procedures related to
a specific class
▪ General Format

define object objectName


member .attribute1 is Real Object Definition
member .attribute2 is String
endfunction

define method .objectName() Constructor Method Definition


endmethod

define method .procedure1()


CODE Procedures Definitions
endmethod

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PML Code Types
• Objects
▪ Call: !objectVariable = object objectName()

▪ It can receive many parameters during the call


▪ !objectVariable = object objectName(!parameter1, ‘text’,430, true)

▪ It can receive many parameters during the definition


▪ define method .objectName(!a is Array, !b is String, !c is Real, !d is Boolean)

▪ Object’s Attributes can be accessed as its procedures


▪ !objectVariable = object objectName()
▪ !firstAttribute = !objectVariable.attribute1
▪ !objectVariable.procedure1()

▪ Extension: .pmlobj

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PML Code Types
• Forms
▪ Are required to be in PMLLIB or PMLUI
▪ Are pretty similar to Objects. The main difference is that they result in a Graphical User Interface
▪ General Format

setup form !!formName


member .attribute1 is Real
member .attribute2 is String Form Definition

FORM Gadgets
exit
Constructor Method Definition
define method .formName()
endmethod

define method .procedure1() Procedures Definitions


CODE
endmethod
© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.
PML Code Types
• Forms

▪ Call: show !!formName

▪ Killing a form: kill !!formName

▪ Hiding a form: hide !!formName

▪ Extension: .pmlfrm

▪ TIP: !!PMLFORMS

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


PML Code Types
• Forms

▪ Call: show !!formName

▪ Killing a form: kill !!formName

▪ Hiding a form: hide !!formName

▪ Extension: .pmlfrm

▪ TIP: !!PMLFORMS

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Codes Examples
• Collecting elements for current element and creating a file with the results

!type = 'PIPE'
!macroAddress = 'c:\aveva\report.txt'
Var !elements coll all $!type for ce
!file = object file(!macroAddress)
!file.writefile('overwrite',!elements)
Syscom 'start $!macroAddress'

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Codes Examples
• Iterating in an equipment array after collecting and executing some actions

!type = 'EQUI'
Var !elements coll all $!type for ce
Do !eachEqui values !elements
markdb
$!eachEqui
!name = name
!name = !name + '-NEW-INFORMATION'
name $!name
Enddo

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


Menu Additions

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.


linkedin.com/company/aveva
@avevagroup

ABOUT AVEVA
AVEVA is a global leader in engineering and industrial software driving digital transformation across
the entire asset and operational life cycle of capital -intensive industries.

The company’s engineering, planning and operations, asset performance, and monitoring and
control solutions deliver proven results to over 16,000 customers across the globe. Its customers are
supported by the largest industrial software ecosystem, including 4,200 partners and 5,700 certified
developers. AVEVA is headquartered in Cambridge, UK, with over 4,400 employees at 80 locations in
over 40 countries.
aveva.com

© 2019 AVEVA Group plc and its subsidiaries. All rights reserved.

You might also like