RelatedTo provides an easy way to filter entities based on the results of another query, representing the entities they are related to.
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 RelatedTo 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 direct relationships, but not indirect relationships, use the field DirectlyRelatedTo 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' }
|
All requirements with a status of approved which have associated bugs that are currently open:
Code Block |
---|
|
EntityType = Requirement AND Status = Approved AND RelatedTo IN { EntityType = Incident AND Status = Open } AND Project = 'Project X'
|
=, IN, !=, NOT IN
Entity
- AgileRun
- AutomatedTest
- AutomatedTestAssignment
- Incident
- Requirement
- RequirementPackage
- TestExecutionPackage
- TestScript
- TestScriptAssignment
- TestScriptPackage
Feature | Supported? |
---|
Aggregation | No |
Sortable | No |
Sub-selects | Yes |