It's all about the answers!

Ask a question

RTC report REST API: how can I query all items which are not finalized for a year or more?

Daniel Llin Ferrero (31139) | asked Apr 09 '18, 10:51 a.m.


I do some reporting stuff by the help of RTC's REST API.
For performance reasons, I want to skip all items which are finalized for a year or more.

In other words, I need to query for all items which are not finalized OR which has been finalized after a specific date.

So I need a positive filter like
resolutionDate > xxxx-xx-xx or resolutionDate is undefined
!(resolutionDate < xxxx-xx-xx)

The latter one doesn't work because there seems to be no logical negation.

The first one doesn't work because I have no idea how I can query for items whose resolutionDate is undefined.

Does anybody has an idea how I can query all items which are not resolved OR are not resolved for more than a year?


One answer

permanent link
Donald Nong (14.5k614) | answered Apr 09 '18, 10:04 p.m.

You can translate "resolutionDate is undefined" to some other condition. For example, if Resolution Date is not set, it means that the work item is not in the Resolved state, so you can use a condition "state/id != resolved_state_id".

Note 1: Neither state/name nor state/group appears to be supported.
Note 2: You can consider using "state/id in (new_state_id, in_progress_state_id, ...)" instead. In either case, if you are dealing with multiple work item types and multiple workflow, you need to take all the states into consideration.

The filter may become quite complicated, but at least it is doable.

Daniel Llin Ferrero commented Apr 10 '18, 4:12 a.m.

 I thought about that approach but I guessed that there must be a cleaner way and a more template-change-robust way to do that. Anyway, the "in"-operator is new to me and will help to ease the pain. ;)

Thank you for your input!

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.