RelationshipOperations Element
Relationship Operations
The RelationshipOperations element is used to relate multiple query views to each other. This allows you to create multiple nodes in the query designer. This also allows developers to add additional nodes to existing query views. The two most common relationship operations are the AddToParentView and AddRelatedView elements.
Note: The PathAlias attribute of an element in the RelationshipOperations collection should not be changed once a query has been released; instead, the DisplayAlias attribute should be added or updated. The DisplayAlias attribute is now used as the UI caption for relationships instead of the PathAlias attribute. In the absence of a DisplayAlias being specified, the PathAlias attribute is used for display purposes. To prevent breaking binary compatibility for previously created ad-hoc queries, you should update (or add) the DisplayAlias attribute rather than changing the PathAlias attribute.
AddToParentView
The AddToParentView element adds the current query view as a related item in another view.
Property | Value | Details |
---|---|---|
ParentView | String | Required. The view to which this view is being added. |
ParentViewRelatedField | String | Required. The field in the ParentView view that relates to a field in this view. |
Field | String | Required. The field in this view that relates to the ParentView. |
PathAlias | String | Required. Provides an alias for the related view as well as a friendly name to be displayed in the UI. |
AddRelatedView
The AddRelatedView element adds related views to the current view as child nodes in the Query field list.
Property | Value | Details |
---|---|---|
Field | String | Required. The field in this view that relates to the RelatedView. |
RelatedView | String | Required. The name of the view being related to this view. |
RelatedField | String | Required. The field in the related view that relates to a field in this view. |
PathAlias | String | Required. Provides an alias for the related view as well as a friendly name to be displayed in the UI. |
AddToParentView vs. AddRelatedView
While both relationship operations are similar, the main difference is the parent-to-child relationship. The AddToParentView element creates a relationship where the current view is the child view and the parent view is specified. The AddRelatedView element creates a relationship where the current view is the parent view and the child view is specified. For example, you could create a query view to track a constituent’s cars. You could then do one of the following:
-
Create a top-level query view for Cars. You can then use the AddRelatedView element to display the main Constituent Query View as a child node to query the owner’s constituent information.
-
Create a query view for Cars that shows up under the main Constituent Query View. You can use the AddToParentView element to make the Cars Query View show up as a child query view under the Constituent Query View.
Since query views included with the product cannot be altered, this enables developers to create query views that have child or parent relationships to the existing query views.
Other Relationship Operations
Two less common relationship operations are available in the RelationshipOperations element on a query view spec.
-
AddTVFRelationship
-
CloneRelationship
The AddTVFRelationship element links a query view to a table-valued function.
The CloneRelationship element clones the relationships from an existing query view.
AddTVFRelationship
The AddTVFRelationship element relates the current query view to a table-valued user-defined function.
Property | Value | Details |
---|---|---|
LinkFunction | String | Required. The name of the table valued function being related to this view. |
LinkField | String | Required. The field in the related function that relates to a field in this view. |
Field | String | Required. The field in this view that relates to the function. |
PathAlias | String | Required. Provides an alias for the related view as well as a friendly name to be displayed in the UI. |
JoinParameters | String | Optional. The parameters passed to the table valued function. References to the view being created should be qualified with 'Link!'. |
This option is useful when more powerful logic is necessary to retrieve the expected results. While views are limited to a single SELECT statement, table-valued functions can contain additional statements. By using a table-valued user-defined function, the complex logic is hidden from end users, and they can query GL distribution as they would any other fields.
CloneRelationships
The CloneRelationships element copies relationship from another query view or function. The Source attribute must specify the source view or function to copy the set of relationships from.