How to Map Custom Properties with Database


Applies To
Product(s):OpenPlant PID
Version(s):08.11.10.XXX
Environment:Windows 7/8.1/10 (64 bit)
Area:Installation-Configuration
Subarea:Database
Original Author:Harpreet Singh, Bentley Product Advantage Group

Background

This article will cover the fundamentals of mapping a custom/existing EC property with Database field. 

To note : the order in which you load the schemas is important.

You must first load the ...projectname\schemas\PlantProjectSchema01.01_AutoPLANT_PIW01.06 schema file

followed by the ...projectname\schemas\OpenPlantPID.01.06 schema file

A.    Add field in Database Table:

Let’s say we have added a property (VENDOR_SUPPLIED) on the EQUIPMENT class and we want to map it to the database field VENDOR in EQUIP Table.

                        

Steps To Accomplish: 

  1. Launch Project Administrator.

  2. Expand the <Project Name> node.

  3. Expand Database node and select ‘Databases’ option.

  4. Select PROJDATA in the right window and click Edit Tables option.

  5. Select EQUIP table in the below dialog box and click Edit button. 

  6. In the next dialog, uncheck “Protected” option (if checked) and click Table design. 

  7. Add a new field VENDOR and set the Data Type to ‘Text’. 

  8. Save the changes and exit from MS-Access and Project Administrator. 

B.    Add mapping in schema:

 Steps To Accomplish: 

  1. Open Class Editor.

  2. Go to Database Mapping>Open.

  3. In the below dialog box, browse to (Operating System Local_Root)\Bentley\PowerPID (SELECTseries 5)\WorkSpace\Projects\OPPowerPID_Metric\Dataset\schemas\PlantProjectSchema01.06_AutoPLANT_PIW01.06 directory and click OK.

  4. Click ‘Edit Database Structure’ button as shown below. 

  5. Select the existing Database Mapping and click Remove.


     
  6. Click Load and type PLANTPROJECT_DATABASEMAPPING in the Name field. 

  7. Select the provider:

    a. For MS-ACCESS database>Microsoft Access Provider
    b. For SQL database> Microsoft SQL Server .Net Provider
    c. For Oracle Database>Oracle.Net Provider
     
  8. Select the PROJDATA.mdb file from AutoPLANT project folder C:\ProgramData\Bentley\Plant V8i\Bentley Plant V8i Projects\SAMPLE_METRIC\Projdata and click TEST. 



  9. Once the structure is loaded, select EQUIPMENT class in Summary tab. 



  10. Expand EQUIPMENT class and select Vessel class under CONTAINER on the left side of the window. 



  11. In the properties tab, scroll down and select VENDOR_SUPPLIED property.



    As highlighted in the picture, it is showing that this property is currently not mapped. If a property is mapped there is a green color drum in front of Property name. Also it shows the mapping in the property section down below:

  12. Click the edit button on the property section. 

  13. In the Edit property mapping dialog, select EQUIP from the drop down menu on the left side. 

  14. Now select VENDOR from the drop down menu on the right side and click OK. 

  15. Save the changes and launch OPPID. 

Note: Currently mappings are not inherited from the Parent class to child classes, therefore, user need to map the properties at the child classes as well.

Verify the result: 

  1. Place a Vessel in the model and add key-in value in the Vendor Supplied field. 

  2. Synchronize the drawing with database.

  3. Once the drawing is synchronized with the database, launch Data Manager and open the Equipment List view.

  4. You will need to add the Vendor field to the view.

  5. Once the Vendor field is added, open the view and check the vendor field.


Case II 

Background:

In OpenPlant PID, user wants to have FACILITY property for Flow Element. When user places any flow element on pipeline and synchronizes from drawing to database. User is unable to get that FACILITY input in Data Manager. User’s requirement is to map FACILITY property in Data Manager.

Steps to Accomplish:

  1. Launch Project Administrator.

  2. Expand Your Project, here Metric project, then Database, go to Databases, select PROJDATA and click on Edit Tables





  3. Select INSTR, go to Edit, click on Table Design, add IFACILITY, Save and click Ok, see below images.







  4. Close Project Administrator.

  5. Launch Class Editor.

  6. Load OpenPlant_PID.01.07.ecschema 



  7. Supplement with OpenPlant_PID_Supplemental_Imperial.01.07.ecschema



  8. Navigate to Flow Element, switch to Properties, click on Add and select New.



  9. Fill below data.



  10. Right click on FACILITY property to add Custom Attribute.



  11. Add Category custom attributes to FACILITY Property.





  12. Fill below Information.



  13. Save all the changes.

  14. Continue Class editor and go to Database Mapping, select open and click OK.





  15. After loading, click on Edit Database Structure in Summary and Remove existing PLANTPROJECT_DATABASEMAPPING.





  16. Now, click on Load



  17. Fill below Data, check Test Connection, click OK and close the dialog.



  18. Now, click on Flow Element, switch to properties, Select FACILITY and click on Edit in Property Mapping Information.






  19. Select INSTR and IFACILITY from the dropdown and click OK.



  20. Save Database Mapping and close Class Editor.



  21. Launch Data Manager.


  22. Expand views and click on Instrument List – Flow Element, right click and select Edit.





  23. Click on Design.



  24. Select IFACILITY field from INSTR Source Table, click on Right Arrow and OK.



  25. Close Data Manager.

  26. Launch OpenPlant PID , Create new file (Metric unit) and place pipeline and flow nozzle.



  27. Synchronize from Drawing to Database.







  28. Verify Instrument List – Flow Element view in Data Manager.



  29. Expand Tables and check INSTR. You can see Facility table and its Input separately in Data Manager.



See Video

Also check video for above mentioned workflow.

communities.bentley.com/.../273170

See Also

communities.bentley.com/.../how-to-create-custom-border-and-map-custom-property-with-database

Comments or Corrections?

Bentley's Product Advantage Group requests that you please submit any comments you have on this Wiki article in the "Comments" area below. THANK YOU!