> For the complete documentation index, see [llms.txt](https://help.auxalia.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.auxalia.com/plant-tools/plantlink/how-to-use/use-cases/getting-tag-from-connected-objects-into-instruments.md).

# Getting Tag from connected objects into instruments

This chapter describes how you can get the Tag into a General Instrument Symbol from the objects the Instrument is connected to.

A link with the project created during this chapter is at the end of this chapter.

{% file src="/files/qbn9GdIRJsa3DHBOmpcv" %}

<details>

<summary>Description of the Use Case</summary>

The image below shows the various uses cases considered in this example. The number in red are the PnPIDs which we will see later in the tables and views.

![](/files/AV5wlOsxfXqD0d6A6R3E)

If you compare the image above and below you will see, that the line segment between the Instruments **PI 1** and **PIC 1** seems to be gone. But this is not the case. Instrument **PIC 1** was just moved to **PI 1** which seems to delete the line segment, but in reality the line segment is still there.

![](/files/AKP0hNPCAVwz5R5te80j)

</details>

<details>

<summary>Involved Tables</summary>

**EngineeringItems** This table is actually not needed for the views, but it gives a good overview of the symbols and line segments in this example. What is missing are the **Pipe Line Groups** and **Signal Line Groups** classes and the **Non Engineering Items** class. But they are not important for our example.

![](/files/nfqjFA6W3kwJXmzhOT5e)

**LineStartAsset** This relationship table tell us from which symbol a line segment starts. The column **Asset** stores the PnPID where the line segment starts. The column **Line** stored the line segment starts. Compare the last row with the images above. You will see, that the line segment 693 start from the valve 688.

![](/files/QGnUTugDLAL42ZG5eW0f)

**LineStartLine** This is similar to the **LineStartAsset** table, but this time the line segments start at another line segment. Compare the row with the images above and you will see, that in **Line1** is the line segment starts at the main line segment 592. Which is stored in **Line2**.

![](/files/CKouoekXCemdC67FX7GP)

**LineEndAsset** This table tells us at which symbol a line segment ends. **Line** is the column which contains the **PnPID** of the line segment and **Asset** hosts the **PnPID** where the line segment ends. Compare the last row with the images above. You will see, that the line segment 693 ends at instrument 691.

![](/files/dTPxpuUM14LfB9TFCCnk)

**LineEndLine** There is also a table which stores if a line segment ends on another line segment. But this use case does not exist in out example.

</details>

<details>

<summary>Creating the View</summary>

Since the **General Instrument Symbols** are connected with different sources, we need to create SQL statements for each of them. Let's start with the **General Instrument Symbols** which are connected with **Equipment**. We need the GeneralInstrumentClass, LineEndAsset, LineStartAsset, and Equipment tables.

![](/files/jYdQZBibggdo7D4I0elY)

Next we connect the tables with relationship lines. The **PnPID** of the GeneralInstrumentSymbol is where the line segment ends. The line segment that ends at the GeneralInstrumentSymbol is the same one that starts on the Equipment.

![](/files/E2kWSYlWxTWaM6RHF1jM)

In our resulting view we need the **PnPIDs** of the GeneralInstrumentSymbols table and the Equipment table.

![](/files/NqEjHFPWKT80lrQtfeVR)

We let SQLite Expert create the SQL Statement.

![](/files/AhD7bdRz3lkz1NJLzFxK)

Now we see the result of the statement and the result. Compare this again with the image at the top. We will later be able to get the Equipment **Tag** for the GeneralInstrumentSymbol **618**. You may also recognize, that the line segment connecting the GeneralInstrumentSymbol with the Equipment plays no role in the resulting data. The line segment is merely connecting the two symbols. Also, the type of line segment plays no role. It can be a SignalLineSegment or a PipeLineSegment of any type.

![](/files/6K3P88vuaYURRDXNAjSv)

That was the first SQL statement, but we have more use cases in our example. To add more SQL Statements we click on the **+** button.

![](/files/P8rcKQixzLGrNwk19J1o)

We will get a blank slate again. Now we will consider the HandValves class. It is essentially the same example as with the Equipment table, but no it is the HandValves table. We cannot use the InlineAssets table though, because the **Tag** property is not available under InlineAssets, but under HandValves class.

![](/files/wLpUy2PKD6v88544qfPw)

We execute the setup from SQL Builder again.

![](/files/dbqYQHjTBBVFdhGEYEh7)

You will recognize, that the is a **UNION** between the two SQL statements. It is like adding the results of both statements together. The result now also shows the Tag of the HandValve.

![](/files/UKty2b4DPno3PEXNm2QU)

We add another SQL statement.

![](/files/TKpWDnsLdKpehTk8fydx)

Now we use again a similar example, but this time we will consider the Instrumentation class. This covers the case of a connection from and InlinInstrument like the ControlValve above, but also a connection from another GeneralInstrumentSymbol.

![](/files/FYjEDLLkY92sok1a1TvP)

Now we have three statements. You may wonder how can the two Limit Switches **621** and **623** get the Tag from the ControlValve, because they are connected with the Actuator. This is because the overall object is from the ControlValves class no matter where exactly you connect to.

![](/files/FNJVIz23DgctnBxtiEKi)

And one last time...

![](/files/1TxxfetSw7zsGBELcnBw)

For the final example, we need the Tag of the PipeLineSegment. Here we don't use **LineStartAsset**, but **LineStartLine**, because the line segment between the main line and the instrument start on a line segment and no a symbol.

![](/files/kzxg2dVZ7zCAAefpIkY6)

Now we covered all 4 use cases.

![](/files/FOoOETDMfYjbyxGFXjfi)

All this work was just to get the SQL Statement and check if the result is what we expect and need. Now we can actually create the View for the database.

![](/files/ImQYbp46WGlrKUrj9NVj)

We copy the SQL Statement into the view and type in some name. We recommend using some prefix. This way all your views you may create in the future are grouped together.

![](/files/TtHfKmSai3uibRn72Xac)

Now you click **Apply** in the lower right hand corner. If there is anything wrong with the SQL Statement, you will be informed.

![](/files/OLQVagv1vaKDDYjL6UcC)

You see the View now in the list between the other views. You can toggle between the **Data** tab and the **Design** tab to either see the result, or the design of the view.

![](/files/LluXR76a7QRWgVIdtV50)

</details>

<details>

<summary>Creating the Link Configuration</summary>

Creating the view was the major part. Now the easy part is creating the link configuration in PlantLink. Create a new Link Configuration and select the ProcessPower.dcf from your project. PlantLink will change this to **\[SQLPID]**.

![](/files/L2dj19DSlEwVAub0OzlL)

By default **Update AutoCAD P\&ID/Plant 3D properties** properties is selected.

![](/files/c2SMXfJeZLbeQqKUXNtx)

You want the data for the **General Instrument Symbols** class.

![](/files/6b4aytyHfFRszl57MrQi)

You select the new view.

![](/files/LFZqotoWrKepiSILTT1F)

You select **PnPID** for the External table column and the Class property. Remember: The first column from the view is the **PnPID** fro the instrument symbol in our drawing.

![](/files/R06qRjIOTKsinxGRdWiY)

We map the **Tag** to the **Location** property of the instrument symbols. Of course if you have another property you can use this as well. Using **On Drawing Save** is a good option to use, because it ensures, that value from the view is mapped when you save and save\&close the a drawing.

![](/files/bCio8nufHfJJwNB8jxBF)

Finally some name.

![](/files/k6lVAwIAGsQ9pNoo565Y)

Make sure, that the link configuration is shown as **Active**.

![](/files/ceyLvLO7oxlQF5TDgzg4)

</details>

<details>

<summary>Test</summary>

Now you save the drawing, which triggers an update of the **Location** property. And we see the **Tags** in Data Manager.

![](/files/7A34YeeRp6fFUxYxugS5)

</details>
