How to query RTC work item children for exact match of multiple attributes?
I am using RTC 4.0.2 and have Epics with multiple Stories linked as children. I would like to run a query that lists all Epics with children that match multiple conditions per child:
[AND All must match]:
Type is Epic
Children > attribute_A is abc
Children > attribute_B is xyz
I am getting ambiguous results with the above query, because there might be a child matching the first condition (attribute_A is abc) and another child matching the second condition (attribute_B is xyz) while there is none that matches both conditions.
I would only be interested in listing Epics having at least one child that exactly matches both conditions.
Is there any way to build a query for this?
Any ideas would be appreciated,
Volker
[AND All must match]:
Type is Epic
Children > attribute_A is abc
Children > attribute_B is xyz
I am getting ambiguous results with the above query, because there might be a child matching the first condition (attribute_A is abc) and another child matching the second condition (attribute_B is xyz) while there is none that matches both conditions.
I would only be interested in listing Epics having at least one child that exactly matches both conditions.
Is there any way to build a query for this?
Any ideas would be appreciated,
Volker
Accepted answer
I think Lauren suggests the only possible way of doing it. The issue is, that although queries can follow relationships, the query language does not contain any means to express "For all children (condition on child)" or other complex conditions that would allow what you want, as far as I know. I once tried to create some queries that attempted this and I was never really able to accomplish it. I have seen some questions here in the forums around similar requirements and the same outcome.
I can't comment on BIRT.
It would be possible to use the API to run queries and to use the results returned for additional computation. Some example code can be found here: http://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/ http://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/ . You could run through result sets, access the resulting work items and do comparisons on the attributes. See http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ and http://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ as well as other posts on that blog.
I am not sure if you could create a server extension that would do the same and be provided as query though.
I can't comment on BIRT.
It would be possible to use the API to run queries and to use the results returned for additional computation. Some example code can be found here: http://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/ http://rsjazz.wordpress.com/2012/10/29/using-work-item-queris-for-automation/ . You could run through result sets, access the resulting work items and do comparisons on the attributes. See http://rsjazz.wordpress.com/2013/01/02/working-with-work-item-attributes/ and http://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ as well as other posts on that blog.
I am not sure if you could create a server extension that would do the same and be provided as query though.
3 other answers
Hi Volker,
A roundabout way to get the results you want is to query for a work item where attribute a is abc, where attribute b is xyz, and who has a parent of type epic. Then you can edit the results to display the parent work item. The problem with this is that the same epic might be listed more than once.
You might be able to create a query like this programmatically and then filter out the results so that each parent epic is only listed once.
A roundabout way to get the results you want is to query for a work item where attribute a is abc, where attribute b is xyz, and who has a parent of type epic. Then you can edit the results to display the parent work item. The problem with this is that the same epic might be listed more than once.
You might be able to create a query like this programmatically and then filter out the results so that each parent epic is only listed once.
Hi Lauren,
thanks for your quick response. Yes, I understand that using a query on the children (Stories) would lead to a precise evaluation of conditions (all stories that have attribute_A and attribute_B).
Unfortunately, I am interested in listing the parent (Epic) as a result of the query as I also need to display some attributes of the parent in the output (and I suppose there is no way to do this if the query returns Stories).
Regarding a programmatic solution, what would that involve? I have started looking at BIRT for building a report but this seemed rather difficult to accomplish.
thanks for your quick response. Yes, I understand that using a query on the children (Stories) would lead to a precise evaluation of conditions (all stories that have attribute_A and attribute_B).
Unfortunately, I am interested in listing the parent (Epic) as a result of the query as I also need to display some attributes of the parent in the output (and I suppose there is no way to do this if the query returns Stories).
Regarding a programmatic solution, what would that involve? I have started looking at BIRT for building a report but this seemed rather difficult to accomplish.