DirectlyRelatedTo provides an easy way to filter entities based on the results of another query, representing the entities they are directly related to (so any indirect relationships an entity may have i.e. bugs associated with a requirement via script references) will not be included.
To better illustrate this, imagine we have a query representing all the high-priority requirements:
Code Block |
---|
|
EntityType = Requirement AND Priority = High AND Project = 'Project X'
|
If we then wanted to find all scripts related to those high-priority requirements, we could use the DirectlyRelatedTo Field like this:
Code Block |
---|
|
EntityType = TestScript AND RelatedTo IN { EntityType = Requirement AND Priority = High AND Project = 'Project X' }
|
Notice we have surrounded the original query for requirements within curly braces - this is know as a "sub-select" - it means we will execute the query within the curly braces first, then use the results of that query to filter the outer query.
If you only wish to match both direct and indirect relationships, use the field RelatedTo instead.
To perform more complex relationship queries, use the Relationships field.
All scripts related to low-priority requirements:
Code Block |
---|
|
EntityType = TestScript AND RelatedTo IN { EntityType = Requirement AND Priority = Low AND Project = 'Project X' }
|
To find all scripts that have a direct relationship to a requirement with a name that includes customer:
Code Block |
---|
|
EntityType = Script AND DirectlyRelatedTo IN {EntityType = Requirement AND Name ~ customer}
|
=, IN, !=, NOT IN
Entity
- AgileRun
- AutomatedTest
- AutomatedTestAssignment
- Incident
- Requirement
- RequirementPackage
- TestExecutionPackage
- TestScript
- TestScriptAssignment
- TestScriptPackage
Feature | Supported? |
---|
Aggregation | No |
Sortable | No |
Sub-selects | Yes |