It's all about the answers!

Ask a question

How do I query RTC work items with a time range


Ravirajan Rajan (112) | asked Mar 03 '16, 9:14 a.m.
edited Mar 03 '16, 9:20 a.m.
 I am trying to use the RTC API to query workitems that have been created within a certain time frame (i.e between July 1 and Jan 1). I am using the property dc:created to do that but not having much luck with the format / syntax for a range.

This is what I am trying to do and it fails with a - TypeError: 'NoneType' object is not iterable

(Note: I am using a python library - https://pypi.python.org/pypi/rtcclient/0.2.0 )

query_string = ('dc:created>="07-01-2015T01:00:00Z" and dc:created<"01-01-2016T01:00:00Z"')

I have tried reversing the > and < and didn't have much luck either

turning on debug shows - INFO query:Query: Start to query workitems with query string: dc:created>="07-01-2015T01:00:00Z" and dc:created<"01-01-2016T01:00:00Z"

I am able to get data for 

query_string = ('dc:created>="07-01-2015T01:00:00Z"')

and also this works

query_string = ('dc:created>="07-01-2015T01:00:00Z" and dc:type="defect"')

Any help would be greatly appreciated.



One answer



permanent link
Ravirajan Rajan (112) | answered Mar 03 '16, 10:38 a.m.
 Figured out the solution - Had to switch the date format to YYYY-MM-DD (from MM-DD-YYYY)

This one works - query_string = ('dc:created>="2015-07-01T01:00:00Z" and dc:created<"2016-01-01T01:00:00Z"')

Thanks

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.