Retrieving objects by complex queries - 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

There are several methods to add criteria to the QueryRequest. Starting with criteria against properties:

Public Sub AddQueryProperty(ByVal pstrInterfaceDefUID As String, ByVal pstrPropertyDefUID As String, ByVal pstrPropertyCriteria As String)

Public Sub AddQueryProperty(ByVal pstrInterfaceDefUID As String, ByVal pstrPropertyDefUID As String, ByVal pstrPropertyCriteria As String, ByVal pstrUOM As String)

Public Sub AddQueryProperty(ByVal pstrInterfaceDefUID As String, ByVal pstrPropertyDefUID As String, ByVal pstrPropertyCriteria As String, ByVal pstrUOM As String, ByVal pintCriteriaJoinType As CriteriaJoinType)

Each of these methods accept an InterfaceDefUID and PropertyDefUID along with some criteria. The criteria parameter can include the following operators in addition to values

  • =, !=, <>, >, >=, <, <=,

  • Between

  • In

For example, to query for all vaults that have a certain value in the SPFLocalPath property:

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

SPFRequestContext.Instance.QueryRequest.AddQueryProperty("ISPFVault", "SPFLocalPath", "= c:\temp")

Dim lobjVaults As IObjectDictionary = SPFRequestContext.Instance.QueryRequest.RunByAdvancedQuery()

The first statement adds an interface to the query to make sure we return a vault. The second statement tests the SPFLocalPath property on "ISPFVault" to see if it equals "c:\temp".