Task 1 - Creating a Query - Intergraph Smart Instrumentation - Training - Intergraph Process, Power & Marine Documentation

SmartPlant InstrumentationTutorial

Language
English
Product
Intergraph Smart Instrumentation
Search by Category
Training
Smart Instrumentation Version
2016 SP1 (11.0.1)
Smart Instrumentation Web Version
(none)

A typical workflow for creating a query involves:

  • Creating, copying or opening an existing query from the Reference Explorer.

  • Selecting Item types from the Item type explorer and adding them to the Definitions Window.

  • Defining the relationships between the selected Item types.

  • Selecting attributes.

  • Previewing the query.

  • Saving the query to the Reference Explorer.

Open a New Query

In this task you will create a query with four Item Types showing the relationships between the parent (Instrument) and its siblings (Loop, Line, and Document).

  1. Open the Reference Explorer and locate the Query Builder folder in the Queries folder.

  2. Right-click the Query Builder folder and from the shortcut menu click New > Query.

  3. On the Query Properties (New) dialog box, in the Name field type Instrument relationship, and check the Suppress Repeating Values check box (this removes any duplicate rows from your query results). If you want you can also add an explanation of what this query does in the Description field.

  4. Click OK, the Query Builder opens.

Adding Item Types

You are now ready to start building your query by adding Item Types to the Definition window and creating their relationships.

  1. From the Item Types Explorer, do one of the following:

    • Drag and drop the Instrument Item Type to the Definition window.

    • Double-click the Instrument Item Type, the instrument appears in the Definition window.

  2. Now you need to add the Loop Item Type to the Definition window and create a relationship between the two items. You can use the same methods as in step 1, or you can right-click on the Instrument and from the shortcut menu click Add relation to > Loop.
    Click an item to select it. A selected item has a shadow border around it.

    Whatever method you choose, you should see the following in the Definitions window:

    • The line connecting the Item Types indicates that the items have a relationship. The Relationship icon opens the Relation dialog box.

    • Click on an item or icon and drag it around the screen to position it where you want.

      When creating relations between plant groups, make sure you start building the hierarchy from the Lowest Plant Group, and work your way up to the Highest Plant Group. Building the hierarchy in any other way does not populate the correct results in the Query Preview.

Define relationships

Now you need to define the relationship between the items

  1. Right-click , the Relation dialog box opens. The Relation field should be displaying Instrument - Loop.

    Certain relationships have only one choice available, for example Instrument to Loop, others have many, for example Instrument to Panel displays a list with all the different panels that can be related to an instrument, Junction Box, Device panel, Marshaling Rack, and so forth. To see in the EDE view those instruments with junction boxes for example, you would select the relationship Instrument - Junction Boxes. In addition, you can see the relationships in the Query Preview.

  2. From the Method group box, make sure that the method, Display only X [Item Type] records and Y [Item Type] records that are related is selected. This ensures that only those rows where each side of the relationship has data are displayed.

    • Selecting the correct relationship method is an important factor in your query returning the correct information. Therefore it is recommended that if you are uncertain as to which method to choose, select Display only X [Item Type] records and Y [Item Type] records that are related.

    • When working with complex queries (three or more item types), it is recommended to use the same relationship method for the entire query.

  3. Click Close.

  4. Now add to the Definitions window two more Item Types that are related to the instrument using the following relationships and method.

    Item Type

    Relation

    Method

    Line

    Instrument - Line

    Display only X [Item Type] records and Y [Item Type] records that are related

    Document

    Instrument - Spec (All cases)

    Display only X [Item Type] records and Y [Item Type] records that are related

    The Definition window should look something like this.

    Drag and place the items in the Definition window to display as above, or click on the , from the toolbar.

    The Relation dialog boxes should look like this:

Adding attributes

After adding the item types to the Definition window, you can now add attributes for some or all of the item types.

When you select an item from the Definitions window, the items attributes are displayed in the Attribute Explorer. By default, when you add an item type to the Definitions window, if the selected items attributes contain the attribute Name then that attribute is automatically added to the Query Attributes tab. For example, selecting Instrument in the Definitions window displays the instrument attributes and automatically adds the attribute Instrument Name to the Query Attributes tab. There are some Item types that do not have an identifying name.

The attribute inserted is referenced as the Specific Item Type Identifier.

  1. On the Definitions window, select the Instrument Item Type. The attribute categories for the instrument are arranged in groups in the Attribute Explorer.

  2. In the Attribute Explorer do one of the following:

  • In the Search field begin to type I/O and as the search results narrow, select Instrument I/O Type Description.

  • Click Identification > Instrument I/O Type Description.

    The Instrument I/O Type Description attribute appears in the Query Attributes tab.

  1. Drag and drop the Instrument I/O Type Description attribute in the Query Attributes tab next to the Instrument Name attribute and before the Loop Name attribute.

  2. Now add the following attributes to the Query Attributes tab and move them next to the relevant attribute.

  • Line - Insulation Type Name.

  • Document - Published Document Type.


    • Use the Search field to locate the required attributes.

    • To remove an attribute, hover your mouse over the top right corner of an item to reveal and click .

    • You can replace the attribute name by typing in the Attribute caption name your own caption. This replaces the attribute name in the Query Builder and in the EDE.

Create a preview

Now that you have finished creating your query, it is possible to preview the data that the query retrieves from the database.

  1. Do one of the following:

    • On the Query Builder toolbar, click .

    • On the Menu, click Actions > Preview.

  2. Click the Query Preview tab to view the preview.

Working with filters

From the Query Preview you can apply filters to the different columns. To apply a filter to a column do the following:

  1. In the Query Preview, click on the Instrument I/O Type Description column.

  2. Select Digital Input and Analog Input.


    The preview now only displays those items that contain Digital Input or Analog Input in the Instrument I/O Type Description column. In a filtered column, the filter icon changes to blue ().

  3. To remove the filter from the column, select the Filter icon, and from the Filter dialog click, Clear Filter ().

  4. Do one of the following:

  • On the Query Builder toolbar, click .

  • On the Menu bar, click Actions > Save Query.

You have now successfully created and saved a new query.