<< Click to Display Table of Contents >> Create an Update Link |
This chapter describes the use of Update Links which map/copy data from a data source into Plant 3D properties.
A link with the project created during this chapter is at the end of this chapter.
For this example the data source is a simple SQLite table. Other data sources can be used too (see Use SQL Server, Use MS Access, Use MS Excel). The Plant 3D databases can be used too (see Getting Tag from connected objects into instruments).
The table we use in this example has 5 columns. The column rowid is shown by default, but doesn't exist in the table. We want to bring in the data from the columns ModelNo, Manufacturer, Price, and Desc into the P&ID properties. This example is supposed to simulate some sort of equipment catalog data.
|
Setting up the Link Configuration
To setup a link configuration we need to open the main user interface of PlantLink from the PlantTools ribbon. Next you click on New... to create a new Link Configuration. This opens the PlantLink Wizard. Since we are using an SQLite database you select Data Source File:. For all other data sources you have to use a UDL file. More about this under Use SQL Server, Use MS Access, Use MS Excel. Click on Browse to open the file selector. In this example, the SQLite database is stored in the Related Files folder in our project. After you click Open the Wizard checks if the path to the database file can be change to a relative path. This makes it easier in case you later want to copy the project. Then there is no need to adapt the Link Configuration. We keep the default selection Update AutoCAD P&ID/Plant 3D properties. The other options will be explained in the following chapters. Since this table contains equipment catalog data, we select the Equipment class to map the data from the table to the equipment properties our P&ID symbols. You can select Tables and Views from the database file. But in this case there is just one table available. Now we need to define the linked fields. This essentially tells PlantLink how to find suitable rows/datasets in the table. It more or less filters the table. In this example, we use the PIDType from the table. This contains P, W, and T (check with the first image above). There are some standard Conditions available. We select = Equals, because the type of the equipment symbol is used to filter for PIDType in the table. Select Type which contains the selection list with the various equipment types in our equipment symbols. The option Show warning box if no suitable datasets can be found opens a warning dialog informing you, that PlantLink couldn't find anything based on the linked column/property. Show only suitable datasets when using 'Assign Data' later limits the presented rows/datasets to only the ones where the linked columns/properties meet the set conditions. Otherwise the PlantLink - External Database Viewer will show all rows/datasets from the table. Next we define the columns from the table and map them to PID properties. The order of the mapping defines the order of the columns when there are multiple choices. The option Behaviour for multiple records controls what should happen, if there are more than one suitable rows/datasets. The default setting is Ask User. In this case the PlantLink - External Database Viewer dialog will show up and the user selects the correct row/dataset. When using Select first matching record PlantLink will just use the first of the found candidates from the table. You select the column and the class property to which the columns should be mapped. The option Write back allows you to later edit the mapped values and have them written back into the table (see Mapping Options). The option Clear Value deleted an existing value in case PlantLink cannot find a suitable row/dataset (see Mapping Options). The option Override Acquisition Mode can change the acquisition to manual in case the property you map to has an acquisition rule (see Mapping Options). For Sync Mode we use On drawing save. This ensures, that the mapping for those properties will be refreshed when the drawing is saved, or closed and saved. So when you close and save your drawing, your mapped properties are up-to-date. More details about Sync Mode can be found under Mapping Options. Finally, we select Price for which there is no PID property available. Therefore, we can have PlantLink create a New Property... without the need of entering Project Setup ourselves and create the property. The property will be created for the selected class in the Wizard. A dialog will appear where you enter the property name and display name. And whether the property should be Visible and/or Read-Only. We type in the following values. We see an * in front of the property indicating a new property. Lastly, we define the name of the Link Configuration. The option Use this Link Configuration in PlantDataManager tells PlantDataManager if this Link Configuration can also be used in PlantDataManager. We now see the Link Configuration in the main dialog of PlantLink and it shows Active. The Link Configuration appearing in alphabetical order. This can become important when Link Configurations depend on each other and must be executed in a certain order (see Rename, Edit, Delete, Deactivate Link Configurations).
|
Testing the Link Configuration
When we insert a pump symbols now which has P as a Default Value in project setup, the PlantLink - External Database Viewer will pop up and offers the two choices for PID Type=P. We use for example the first row. After that, the Assign Tag dialog pops up where you define your Tag as usual. If we look at the properties we see, that Model Number, Manufacturer, Description, and Price. For the images we configured the PlantExpressTools PropertiesPalette (see Properties Palette). When inserting a heat exchanger symbol, again the PlantLink - External Database Viewer will pop up. We again select the first row. And we see the mapped data in the properties. When inserting a Tank symbol though, there will be no PlantLink - External Database Viewer popping up, but we see the mapped values. This is, because there is just one row in the table for PIDType=K.
|
More details about changing and selecting mapped data can be found under Select different row from source.
Next Chapter: Create Extended Link