Modifying the Branch and Pipe DBVW using SRCELE – A Worked Example 7.6
7.6.1 Copying a Database View
7.6.1.2 Selection using Nested SRCELE’s
The expression that selects the Name of the Fluid Reference of the Pipe Spec of the Branch, NAMN OF FLUREF OF PSPEC can be derived using Source Elements rather than via an Expression.
Getting to the NAMN of the FLUREF from the BRANCH requires two navigational jumps across PDMS Elements. As shown below, the PSPEC points to a SPEC element that has a FLUREF attribute which, in turn points to a FLUI element that has a NAME attribute.
BRANCH
Using nested SRCELE’s the same navigation and attribute can be retrieved. The following steps will take the user through the creation and definition of Nested SRCELE’s.
Select the Data Sources tab and in the tree-view select the node named DBVW Branch Details with SRCELE View.
Using the right-click context menu select the option New SRCELEMENT.
A child SRCELE (Source Element) has been created under the tree-view. The SRCELE needs to have its properties set to determine the source PDMS Element.
In the tree-view of the editor, ensure the newly created SRCELE is the CE and the Properties as shown:
Description: Branch Specification
Expression: PSPEC
Expression type: PML
The Data Sources tab should now be as follows:
Now make the SRCELE Branch Specification node in the tree-view the current selection and using the right-click context menu select the option New SRCELEMENT. This will create another SRCELE, but this time it is created under the previously created SRCELE.
Making sure that the newly created SRCELE is the current element in the tree-view, set its Properties as shown:
Description: Specification Fluid / Medium
AVEVA Plant (12.1) Lexicon TM-1308
85
www.aveva.com
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.
The Data Sources tab should now be as follows:
The next step is to modify the Database View column that navigates and returns the Fluid Name, to use the nested SRCELE source element. To achieve this, select the Columns tab in the editor to view the columns.
Select the row that has the Attribute/Expression cell set to NAMN OF FLUREF OF PSPEC, and change the Data Source cell value to Specification Fluid / Medium from the pull-down list.
Replace the Attribute/Expression cell value by entering the attribute name NAMN; as before, the Column Name should be changed to make the field easily recognisable. Enter Fluid Name into the cell.
The final database views columns should now be defined as shown below:
The user performs a Save Work at this point.
7.6.2 Testing the Database View
In order to check that the Database View is returning the correct information and because the Element type was set to a Design BRANCH, the view will only produce results within the Design module using a Report.
To switch to the Design module, from the main toolbar select Lexicon > Modules > Design > Macro Files Click Yes when prompted to Leave Lexicon and enter Design?
In the Design module, a pre-defined report is run by selecting from the main menu Utilities > Reporting >
Designer… to open the Report Designer window.
Refer to TM-1004 AVEVA Plant (12.1) Reporting for further information on Reporting methodologies.
Using the Look in option list on the Open Report dialog, select the option <Browse…>
This will open the Browser For Folder dialog. Navigate to the folder:
C:\AVEVA\Plant\Training12.1\Training\Reports, Click the OK button to close the dialog.
Select the report TM-1308_Lexicon_Database-Views_WorkedExample2_Repor, from the list of Report Definitions and click the Open button.
The report needs to be attached to the database view that has been created in the worked example. To do this, click the Data source button on the toolbar to display the Data Source Wizard.
On the initial page of the wizard, select the Copy option and click Next >.
On the next page of the wizard, select the View with the Name Branch Details 2, and click Next >.
The user will be prompted with the following warning.
Click the Yes button.
On the next page of the wizard click Finish.
In the Field List tree-view, expand the node called Branch Detail 2. The columns defined in the database view are listed here, and the user is able to see how the Name and Column Name values of the database view are used for distinguishing the field names used within the report.
Click the Run Report button on the main toolbar to run the report.
Examine the resulting report preview and check that the attribute data for Branches and Pipes is being returned.
Close the Run Report preview window, and the Report Designer window.
Now the user must switch back to the Lexicon module. From the Design module main menu select Design
> Modules > Lexicon…
Click Yes when prompted to Leave Design and enter Lexicon?
AVEVA Plant (12.1) Lexicon TM-1308
87
www.aveva.com
© Copyright 1974 to current year.
AVEVA Solutions Limited and its subsidiaries.
All rights reserved.