Exercise 5 – Status Control
4.6 Database Views Definition
A Database View is a Dabacon based functionality with which attribute data of elements can be collectively configured to map into the cells of a table. These tables can be generated as lists, indexes and reports.
A Database View definition is based on any available element type, with column references to a selection of its attributes or expressions defined beneath.
The Database View definition will allow a table to create and list instances of the element type (database items) in rows with the columns controlled by their selected attributes or expressions (PML 1 or XPath 1.0 expressions).
In other words, as a Database View it supports a list view table, where each row of that table will be an instance of an element type(s), and the cells of each column will either be a value of an attribute or expression based on the corresponding row element.
It is possible for each row to represent data from multiple element types and also multiple database elements may be modified if a row of data is edited in a grid or via an importDatabase Views control
A generated engineering list consists of rows and columns, and is based on a Database View. Row entities are controlled by the applicable element types, as each row is an instance of that element type, hence a database item. Columns are controlled by element attributes or expressions, hence referred to as ‘Attribute Columns (ATTCOLS)’ and ‘Expression Columns (EXPCOLs)’
Defined Database Views will consist of a base element type, and configurations for Attribute columns. Other configurations might include Expression columns, attribute filters and item Creation rules.
Attribute Columns (ATTCOLs)
Expression Column (EXPCOL)
www.aveva.com
The Database View can also be defined for additional element types, making it possible to include their attribute and expression data onto the same list / table. These additional element types can be configured as
‘Source Elements’
For an engineering project setup, the Database Views definition helps performs the following functions:
- Specifies the major element (UDET) which a list is based on
- Specifies properties which are available as list attribute columns and expression columns - Defines the required contents and behaviour of an engineering list
- Defines the creation requirements and criteria for list items - Defines the presentation structure of list items
Each block on the diagram is defined as shown:
DBVWW
Used to group definitions into manageable administrative sets, this is for administration only and is not visible to users in other
contexts.
Database View Set:
Used to group Database Views for user presentation. These should contain related views as they are visible to the user. A Database View can be a member of a Database View Set even if it is not a direct member.
91
www.aveva.com
© Copyright 1974 to current year.
DBVW Database View
A table definition that defines the display name, element criteria and columns
ATTFIL
EXPFIL
ATTCOL
Attribute Filter:
An attribute filter is a test executed against the selected element based on the value of a specified attribute such as DESC Equals Vessel. A database element must match all filters present in the Database View to be present in the resulting table
Expression Filter:
An expression that must evaluate to TRUE or FALSE to determine whether a database element is part of the database view. A database element must match all filters present in the Database View to be present in the resulting table
Attribute Column:
This is an element which defines columns based on a single attribute. Attributes may be system attributes or UDAs. Qualifiers can be specified where required such as when accessing the status of a particular element. Columns based on attributes are by default editable but can be made to be read only to help with workflow management
EXPCOL
SRCELE
Expression Column:
This is an element which defines columns based on a PML or XPATH expression. Expression columns are read only unless software is written to make them editable.
Source Element:
This is an element which defines a navigational step from the current context element to another database element. All columns defined in the Source Element are then based on the element that results from the navigation. Such columns are editable so rows in Database Views allow editing of more than one database element.
www.aveva.com
Typical Database Views setup will have most of the hierarchical elements configured, but this depends on the purpose and use of resulting lists and tables based on the Database Views.
The following sections will describe the definition steps of a Database View, and the configuration of its hierarchical elements.
CRERUL
Creation Rule:
This defines the rules for element creation. If within a DBVW element then the rules permit row creation for the Database View provided that the AUTCRE attribute is set to TRUE. Information such as where to create the new item or what type of element to create can be fixed or specified using expressions
SETPAR
SETATT
SETSTA
Set Parameter:
This is an element used to define parameters for expressions in other create rules. A parameter can be used in expressions on the CRERUL, SETATT or TESTEX elements. Parameters provide the ability to prompt a user for a single piece of information and then use it in multiple expressions
Set Attribute:
This defines a rule to set a database attribute when the element is created. This allows attributes to be defaulted at the point of creation and forces a user/application to provide a mandatory attribute value at the time of element creation.
Set Status Rule:
This defines a rule to assign a status to the created item at the time of creation. This will help ensure all elements are being status managed
TESTEX Test Expression:
if this evaluates to true then the owning rule will be carried out, otherwise the owning rule is ignored
COLREL
Column Relation:
This element defines a Parent/Child relationship between columns for application use. These relationships are currently not supported in the standard applications
93
www.aveva.com
© Copyright 1974 to current year.
Database Views Setup
Database Views are defined via the Database Views Editor within the LEXICON and Tags modules, or with the Current Element Editor within the LEXICON module as was originally default.
The Database Views Editor is a General user interface for the creation and definition of Database Views in a quick and user friendly manner.
The Current Element Editor includes the criteria for selecting and entering elements from which the rows are constructed, as well as all applicable attribute and expression data required for column control. As Database Views entries are placed in a hierarchical order beneath a Database View world in the dictionary explorer, the Current Element Editor defines the criteria for each entry in all levels of the hierarchy.
The following example will demonstrate the definition of a Database View for a mechanical equipment. Like previous examples, this utilises the supplied demo project.
Create Database Views World (DBVWWLD) Select the topmost element in the
dictionary explorer (Dictionary World), right click to display the context menu.
Select the ‘Create’ entry, to display a sub list of dictionary elements worlds, and select the ‘DBVWWLD: Database View world’ entry, to create a Database View world.
With the Current Element Editor, fill in the attribute details of the created DBVW world as shown.
www.aveva.com
Create Database Views Group (DBVWGR)
Select the created Database View world
‘ENGINEERING-DATABASE-VIEWS’, and Create a
‘Database View group’
(DBVWGR) using the context menu.
With the Current Element Editor, fill in the attribute details of the created DBVW world as shown.
Database Views (DBVW)
Select the created Database View group
‘MECHANICAL-VIEWS’, and Create a
‘Database View (DBVW) using the context menu.
The Current Element Editor form of the Database View includes entries for a ‘User Defined Name’, as this will be the identifier for the Database View. Required Element Type(s) can be selected, as list data will be based on this.
’Auto Creation’ is set to ‘True’ as this will allow the creation of new rows (new instances of the selected element type) on any generated list/table which is based on this Database View.
95
www.aveva.com
© Copyright 1974 to current year.
Setting the ‘Allow Deletion’ to ‘False’would make it impossible to delete an item from a list which is based on this Database view
The utilized element type :EQUIPMENT is an engineering UDET which has been pre-defined for this exerciseAttribute Columns (ATTCOL)
Select the created Database View ‘MECH-EQUIPMENT-BASIC’, and Create an
‘Attribute Column’ (ATTCOL) using the context menu.
The section ‘Basic definition’, of the Current Element Editor form of the Attribute Column includes entries for a ‘User Defined Name’, as any entered value will be displayed as the default caption (Column header) of the column on a list/table. Required and applicable attributes which have been appended to the utilized element type can be filled in, as the column will be based on this attribute.
The ’Read only’ entry is set to ‘False’ as this will allow the values within the list/table columns to be editable.
Fill in the attribute details as shown.
The utilized Attribute :TAGNUMBER entry is an engineering UDA which has been pre-defined for this exercise. Utilized attributes must already have been predefined and existCreate 4 more Attribute Column (ATTCOLs) as shown.
www.aveva.com
Expression Column (EXPCOL)
Select the created Database View
‘MECH-EQUIPMENT-BASIC’, and Create an ‘Expression Column’
(EXPCOL) using the context menu.
The section ‘Basic definition’, of the Current Element Editor form of the Expression Column includes entries for a ‘User Defined Name’, as any entered value will be displayed as the default caption (Column header) of the column on a list/table. Required and applicable expressions and the expression type are filled in, as the column will be based on this expression.
Generated expression columns will be marked as ’Read only’ by default, as their cell values are derived, and not directly entered nor modifiable.
Fill in the attribute details as shown.
Create an additional expression column (EXPCOL) for ‘Status’ definitionsAttribute Filter (ATTFIL)
Select the created Database View
‘MECH-EQUIPMENT-BASIC’, and Create an ‘Attribute Filter’ (ATTFIL) using the context menu.
97
www.aveva.com
© Copyright 1974 to current year.
The section ‘Basic definition’, of the Current Element Editor form of the Attribute filter includes entries for an attribute with which the filter will be based on. The ‘Filter operator’ defines the condition/criteria for the selected attribute. The ‘Filter value’ is a value which applies to the condition/criteria defined.
In this case, any generated list/table based on this Database View will only display a :TAGNUMBER column which contains values starting with the characters ‘16’. Every other Tag number will be filtered out.
Fill in the attribute details as shown.
Expression Filter (EXPFIL)
Select the created Database View
‘MECH-EQUIPMENT-BASIC’, and Create an ‘Expression Filter’
(EXPFIL) using the context menu.
The section ‘Basic definition’, of the Current Element Editor form of the Expression filter includes entries for an Expression, and Expression type with which the filter will be based on. The expression filter is utilized if the attribute filter is not sufficient to filter elements, but rather complex conditions are required. A PML type expression could be (:equiclass eq ‘Pump’).
Expressions can be used to define conditions/criteria to filter values displayed in a generated list/table. This will not be filled in, as it is not required for this exercise. ‘Expression’ will be left ‘unset’.
www.aveva.com
The section ‘Basic definition’, of the Current Element Editor form of the ‘Creation rule’ includes entries for an ‘Owner Expression’, which is an identifier for the engineering group (ENGGRP) where new :EQUIPMENT type items / instances will be created and stored. The ENGGRP exists in the engineering database, and can be accessed via the Tags module. Its name will serve as the ‘Owner’ of any new EQUIPMENT items.
The Owner Expression type indicates the type of expression used. The ‘Type expression’ entry requires an expression which identifies a specific element type which a created item is based on. This is not essential since the utilized UDET (:EQUIPMENT) can be derived.
Defining the Creation rule ensures that each time a new item is being created on the Database View list / table, a prompt form appears requesting values for required or optional preconfigured parameters.
Selecting ‘True’ for the ‘Create ancestors’ entry makes it possible for new items to be created and stored in any other existing ‘Owner element’ (ENGGRP) database hierarchy within the Tags module), if an ‘Owner Expression’ is not defined.
The user will be prompted to select from an existing ENGGRP, or create a new one, during the creation of a new database item.
Fill in the attribute details as shown.
This means that items created in a list based on this DB view, will be saved in the ENGGRP Mechanical-Items99
www.aveva.com
© Copyright 1974 to current year.
Set Parameter (SETPAR)
Select the created Creation rule
‘MECHANICAL-VIEW-CRERULE’, and create a ‘Set Parameter’ element using the context menu.
The section ‘Basic definition’, of the Current Element Editor form of the ‘Set Parameter’ includes entries for a ‘User Defined Name’, as this value will be the identifier for the parameter.
The value in the ‘Expression’ entry indicates that whenever this parameter is utilized, any expression value will be evaluated.
The ‘Creation rule’ ensures that a prompt form for the entry of parameter is displayed during the creation of database items in the Tags module, hence the ‘User Prompt’ entry ‘Tag Number’ will be displayed on that form where the user can enter a relevant value. Setting the entry for ‘Required’ to ‘True’ ensures that this will be a mandatory requirement for item creation. If set to ‘False’ then the parameter entry on the prompt form will be listed as ‘Optional’.
Fill in the attribute details as shown.
Create 4 further ‘Set Parameter’ rules and fill in the attribute details as shown.
www.aveva.com
The Tag Number, Tag Prefix and Tag Letter parameters will be displayed as a required (Required:True) entry on the ‘Creation rule’ prompt form, and entered values will be utilized in any expression in which they apply
The Tag Suffix parameter will be displayed as an optional (Required: False) entry on the ‘Creation rule’ prompt form, and entry of values is not mandatory101
The section ‘Basic definition’, of the Current Element Editor form of the ‘Set Parameter’ includes entries for ‘Attribute’, as this is the selected attribute values will be controlled by the rule.
The ‘Expression’ entries will extract the values to be utilised for the selected attributes of items to be created.
In this case, the expression points to the defined parameters, as these parameter values are entered in the Creation rule prompt form.
The entered parameter values will then be evaluated according to the expression, and a final value will be appended to the attribute of the newly created item.
The ‘Required’ entry is set to ‘True’, ensuring that the application of this rule is mandatory.
Create 2 further ‘Set attribute’ rules and fill in the attribute details as shown.
Enter the expressions '/$!TGPre-$!TGLet-$!TGNum-$!TGSuf' for ‘Mechanical Tag name rule’, ’$!TGPre for the Tag Prefix rule, $!TGLet for the Tag Letter rule, $!TGNum for the Tag Number rule and '$!TGSuf' for the ‘Tag Suffix’ rule
www.aveva.com
Set Status (SETSTA)
Select the created Creation rule
‘MECHANICAL-VIEW-CRERULE’, and create a ‘Set Status’ element using the context menu.
103
www.aveva.com
© Copyright 1974 to current year.
The section ‘Basic definition’, of the Current Element Editor form of the ‘Set status’ includes entries for
‘Status Definition Ref’, as this allows the user to select from a drop down list, a required status definition with which this rule applies.
The Set status rule appends the Initial status value of the selected status definition to newly created items on a Database View list / table.
The ‘Required’ entry is set to ‘True’, ensuring that the application of this rule is mandatory.
Fill in the attribute details as shown.
The utilized Status definition ref ‘ENGR-STATUS-DEFINITION’ was previously created and already exists for the purpose of this exercise
When a new engineering item is created, it will be appended with the initial status value defined for the selected status definitionwww.aveva.com
The section ‘Basic definition’, of the Current Element Editor form of the source elements includes an entry for ‘Expression’, in which an expression extracts the element type whose attribute data will be defined beneath.
In this case,selected attribute data of the distributed UDET (:PROCESS-DATA) will be populated and available on the same Database View list / table together with the attributes of the ‘:EQUIPMENT’ UDET.
Although the ‘Expression’ entry can reference the distributed UDET (:PROCESS-DATA), other expressions can be formulated to extract attribute values from other element types or UDET as a source element.
Fill in the attribute details as shown.
The Database View list / table will now be able to contain and display attribute data from the source element, as well as the original selection of attribute data from the original engineering UDETSelect the created Source
105
www.aveva.com
© Copyright 1974 to current year.
The UDETs which are referenced as source elements were earlier defined for this exercise
Expression columns (EXPCOL) and Creation rules (CRERULES) can also be created as described previously
The attributes (e.g. :NORMOPPRESS, :NORMOPTEMP) utilized for the attribute columns, must be defined for the UDETs of the source elementsSelect the created Database View ‘MECH-EQUIPMENT-BASIC’, and Create another ‘Source element’
(SRCELE) using the context menu.
Then select the created Source element named ‘MECHANICAL-EQUIPMENT-ELECTRICAL-DATA’, and Create attribute columns (ATTCOLS) for (:MOTORSPEED and :RATEDTORQUE) as shown.
www.aveva.com
Preview created Database View list/table
Within the AVEVA Engineering – Tags module, create and display a new list / table from a suitable category, and based on the previously created Database View.
See AVEVA Engineering 14.1 Basic guide for the creation and display of a list within the Engineering applicationDatabase View Set (DBVWSE)
Select the created Database View group
‘MECHANICAL-VIEWS’, and Create a
‘Database View Set (DBVWSE) using the context menu.
The section ‘Basic definition’, of the Current Element Editor form of the Database View includes just an entry for a ‘User Defined Name’, as this is what the Database View Set will be identified with.
Source Elements (SRCELE) DB View Element (UDET)
107
www.aveva.com
© Copyright 1974 to current year.
The Database View Set is simply a collection of created Database Views as required. Database View Sets can be created to hold a number of Database Views which apply to a specific element type, a discipline, or tasks.
Click on any existing Database View, drag and drop into the created Database View Set.
The Database View Sets shown was defined using additional Database Views configured for this demonstrationDatabase View management
Database Views and Database View Sets can be managed within Definition sets, although these Definition
Database Views and Database View Sets can be managed within Definition sets, although these Definition