Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

Accessing DB Elements As Objects

  • Last UpdatedOct 24, 2022
  • 1 minute read

A special Global variable !!CE has been provided which always refers to the current element in the database. !!CE can be used to obtain the DB reference of the current element:

!Item = !!CE

!!CE is of type DBREF so the new variable !Item will also be of type DBREF. The dot notation can be used to access attributes and pseudo-attributes of a database element:

!Bore = !Item.bore

This form of access can also be used directly on the !!CE variable:

!Owner = !!CE.owner

It is also possible to follow references between DB elements using this mechanism:

!Rating = !!CE.cref.pspec.rating

Assigning a new reference to the !!CE variable makes the new reference the current element by navigating to it in the database:

!!CE = !!CE.owner

P-points are accessed using the P-point number like an array subscript. For example, to access the direction of P-point[1]:

!Dir  = !!CE.Pdirection[1]

$* !Dir is a DIRECTION object.

To access the position of P-point[3]:

!Pos = !!CE.Pposition[3]

$* !Pos is a POSITION object.

A NULREF is treated as UNSET, so a NULREF can be tested for in two ways:

if ( !MyDBRef EQ NULREF ) then

if ( UNSET( !MyDBRef ) ) then

There is also the function BADREF which will detect whether a database reference is unset or invalid (as in, impossible to navigate to):

if (BADREF( !MyDBRef ) ) then . . .

Note:
Use full-length names for attributes as listed in the Appendix for compatibility with future releases.

TitleResults for “How to create a CRG?”Also Available in