Retrieving objects by interface and name - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

Another common way of retrieving objects is by interface and name. This is analogous to the QFind methods exposed through the client. On the QueryRequest class, first call one of the following methods:

Public Sub AddQueryInterface(ByVal pstrInterfaceDefUID As String)

Public Sub AddQueryInterface(ByVal pstrInterfaceDefUID As String, ByVal pblnIncludeImpliedByInterfaces As Boolean)

For example, simulate doing a QFind on vault by name.

SPFRequestContext.Instance.QueryRequest.AddQueryInterface("ISPFVault")

Dim lobjVaults As IObjectDictionary = SPFRequestContext.Instance.QueryRequest.RunByName("SPF40Vault")

Dim lobjVault As IObject = lobjVaults(0)

The first call (AddQueryInterface) adds criteria to the query such that the object must have the "ISPFVault" interface. The RunByName method then adds additional criteria and executes the query.