It's all about the answers!

Ask a question

How can I exclude items from a query result which have a parent of specific type and which is filed against the same category?


Daniel Llin Ferrero (3128) | asked Nov 20 '18, 11:24 a.m.

I have an actually simple problem to solve:

I need to create an RTC query which contains an expression like "has no feature as parent item which category is the same as 'mine'". So I want to exclude those items which have a parent of a specific type (a "Feature" in our process template) which is filed against the same category.

How can I accomplish that?

BR
Dan

One answer



permanent link
Ian Wark (79713550) | answered Nov 26 '18, 12:05 a.m.

I think you can achive these conditions using the below: 


Use [Parent] > [Type] with "is not" XXX.

Use [Filed Against] and "is" and Check the "Related to Current User" check box.

SampleConditions



Comments
Daniel Llin Ferrero commented Nov 26 '18, 7:50 a.m. | edited Nov 26 '18, 7:50 a.m.

Hi Ian!

Thank you, but I guess this will not solve my problem. Maybe I need to be more precise. This is some pseudo code for my query:
An item A is in the result set, if and only if....
    
    (
        A.state == "foo"
    )
    AND
    NOT (
        ∃ item B:
        B == A.parent
        AND
        B.type == "Feature"
        AND
        B.category = A.categroy
    )
So, the critical think is the very last criterion: Comparing a related items attribute value with the value of the item the query is applied to.

The use case is simple: we have a control board which discusses new feature proposals (in a certain state). The query we are looking for is the query which gives the items to be discussed in the control board. Now we have the rule, that child-items, which are filed against the same category as their parent do not need to be discussed there. (But this does not hold for children which are filed against other (sub-)categories necessarily).

So, this is why "parent has same category" is important.

Best Regards,
Dan


Ian Wark commented Nov 26 '18, 8:24 p.m.
I think it is not possible to obtain "child items which are filed against the same category as their parent". You can only choose a specific category or the Related to Current User option. And I don't think there is a grouped AND NOT option. For this kind of thing, I think you might need to create a JRS report, where you can specify more complex logic. In Report Builder, if necessary you can also go to the Advanced section under Format Results tab and adjust the underlying SQL to match your requirement.

There are lots of RFEs to improve the logic options in queries so that they are more robust. FYI.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.