Retrieving objects by querying on related properties - 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

Below you will see an example where we want to get a collection of role assignment objects for the current user. We use the AddQueryProperty to expand a named relationship and filter the query based on user name, so the query will only bring back role assignments for a particular user.

SPFRequestContext.Instance.QueryRequest.AddQueryInterface("ISPFRoleAssignment") SPFRequestContext.Instance.QueryRequest.AddQueryProperty("SPFRoleAssignmentUser", ExpandRelationDirection.UID1To2, SPFRequestContext.Instance.Server.Context.UserName)

lcolRoles = SPFRequestContext.Instance.QueryRequest.RunByAdvancedQuery

A new overload to this method has been added that will allow you to specify the name interface and property on the other side of the expansion. The one above just filters on the name of the related object, and you can specify the RelDef or EdgeDef UID.

Public Sub AddQueryProperty(ByVal pstrRelorEdgeDefUID As String, _

ByVal pobjRelDirection As ExpandRelationDirection, _

ByVal pstrInterfaceDefUID As String, _

ByVal pstrPropertyDefUID As String, _

ByVal pstrPropertyCriteria As String)