Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How do I querry if fields are NULL or not set?

I am using the restful web interface into a 4.0 version of RTC.  I can do many queries for specific =, <, or > but I am unable to find a way to search for NULL values.  I would like to get results for when a workitem does not have a resolutionDate, or if it does have a resolutionDate so that I could get reports of all resolved or unresolved work items.


This same unresolved question appears at http://www.ibm.com/developerworks/forums/thread.jspa?threadID=467391&start=15&tstart=0.

0 votes



3 answers

Permanent link
Hi Donald,
Some attributes have an "Unassigned" option:

Resolution date doesn't have that option.  However, if you're simply looking for a list of unresolved or resolved work items, the Status can be queried for Unresolved or Resolved:

0 votes

Comments

Thank you for answering, but I am not looking for how to do this via the gui options.  I am looking for how to query this with the rest interface. 

Here is an example:
https://jazzserver.com:9443/jazz/rpt/repository/workitem?fields=workitem/workItem[creator/name=%27Donald%27%20or%20owner/name=%27Donald%27%20and%20projectArea/name=%27PRojrect%27]/%28id|summary|target/name|state/name|creator/name|owner/name|type/name|resolution/name|parent%20%29&size=100&pos=100

I can print out the 'resolutionDate', I can also search for a specific date, but I do not know how to search for 'resolutionDate' that is NULL or NOT NULL. 

Hi Donald,
I don't have any experience with creating queries using the rest interface.  It seems like it should be possible to query for unresolved or resolved in the same way that the gui does.  https://jazz.net/forum/questions/13870/querying-for-sorted-list-of-quotunresolvedquot-work-item has an example that might help you.

He Lauren,  that example shows some language (java maybe), but I am not sure how to translate that back to the REST web query.  Also, it is a workaround of getting a value by keying off another value.  It does not answer how to do the general query of how to find NULL or NOT NULL.  I will be writing many different queries and would need to check for NULL on any field. 
Thanks for you input, and I hope we can find someone who knows this interface that can give an answer.


Permanent link
Is there a valid answer to this question?  I'm tasked with the same issue, trying to create a REST based query where the field / entry is null.

0 votes

Comments

I wish there was, I was never able to figure it out. 

In OSLC specification, there is no mentioning about testing null value in the query capability, so I doubt that any product implementing OSLC will have such capability.


Permanent link

The only way to do this, that I can see, is either:

state/id=open state1id or state/id=open state2id
OR
state/id!=closedState1id and state/id!=closedState2id

So this is stinky. But don't worry, it gets stinkier!

If you need your application to be dynamic to support a variety of projects with a variety of states... or don't want to worry about maintaining the list of open or closed state ids... then you can programatically get the state ids of the states in the closed group, like so:
1) Query the project area for work item type ids (using OSLC):
/ccm/oslc/types/_ProjectAreaId

2) Iteratively query each of the work item shapes for work items you're interested in to find the workflow IDs:
/ccm/oslc/contexts/_ProjectAreaId/shapes/workitems/workItemId (from step 1)
Note: This query requires OSLC version 2.0, so you must set a header: "OSLC-Core-Version: 2.0"

3) Iteratively query the workflow IDs found in step 2 to determine available states, and state groups:
/ccm/oslc/workflows/_ProjectAreaId/states/workFlowId (from step 2).

It sure would be nice if there was an easier way. Normally I would never resurrect an old post... but I had this question and could not see another answer in the forum... so had to go and painfully figure this out.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,017
× 201
× 137

Question asked: Mar 06 '13, 9:46 a.m.

Question was seen: 8,054 times

Last updated: Nov 01 '19, 12:18 p.m.

Confirmation Cancel Confirm