execute query to search work items
Hi all,
I am trying to develop a function to search work items by any term within a project area.
My code works fine for the standard attributes:
Code:
I added 3 custom attributes and i need to search within these fields. So, i added the following lines:
When i try to process the results with:
I get every time an exception:
Thanks in advance.
(please let me know If there is a way to use a REST webservice to search work items in a particular project area)
|
2 answers
You can't see your custom attributes when creating a query in the web UI? Are you saying that you can't query using your custom attributes at all??? You should be able to do it, of course. I would focus on fixing that before considering to use the API.
The CONTAINS operator can be used with Large HTML attributes. However, if you just need to search across several project areas, JRS is by far the easiest option. It only takes a minute to create such query. If you still need to retrieve those work items using the API for whatever reason, I would do as I suggested before: create the queries manually for each Project Area and run them using the API. Comments
Marco Bauer
commented Oct 26 '16, 9:43 a.m.
I can display my custom attributes in the results, but i'm not able to set a condition on these attributes.
|
"I can display my custom attributes in the results, but i'm not able to set a condition on these attributes." Something is definitely wrong with that. As I said, I would focus on fixing that. Have you contacted IBM Support? " I wanna have a score in combination with the results. When i use a manually defined query, I can't get a score..." As I said, I would use JRS for that. It'll be a hundred times easier to implement than creating a Java API script, and a hundred times faster to run. If you can't use JRS, I would also consider BIRT. |
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.
Comments
Your code looks ok.
Are you sure this attribute allows the CONTAINS operation? Is it a String type attribute? Can you use such condition for that attribute creating the query manually? Does replacing CONTAINS with EQUALS make your script work or it also fails?
I always found the Query API a bit complicated. Is there a good reason to build all the conditions using this API like you are doing, instead of creating the query manually and just run it using the API? That would be a lot easier.
Hi Miguel,
This attribute is from the type of "Large HTML".
I tried to use EQUAL and it doesn't work as well as the CONTAINS operation.
When I try to create the query in the web UI, I can not see my custom attributes.
The reason why I wanna use the Java API is, I would like to develop a search across several project areas.