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

How to use parametrized queries in plain java API

Hello,

I created a personal query, that, among other search parameters, has Summary=<provide value at query run> (so the value is not preset, but dynamic.

Assuming I have an IQueryDescriptor that corresponds to this query, how would I go about providing the parameter to run this query?

1 vote

Comments

I would check Ralph's blog for dynamic query construction. I haven't done this myself.

Neither have I. Unfortunately. I would be interested in how it works too.
I have done construction of queries, but I am not sure how parameters are represented and filled.

Thank you, you're right that's not a good workaround.

did u see the syntax below? 

 
query ? jsonParameterValues=(attribuedId)??attributeId=(attributeId)??operator(is)??values(value)

so I think you could construct that into the query code in plainjava (the product does)



3 answers

Permanent link
What I actually did is create a query without the parametrized attribute, cache the results in my program, and perform the search based on the attribute inside the java program.
This is actually ok, as it saves me from running the query over and over again with different parameter values.

1 vote


Permanent link
I hate it when u make me work to answer a question!!.. but I learn something

so, using the web ui, run the query, then push the print button to get the URL

in my case the query is find the workitem(s) with the old_wi_id field with value=?, in this case the data was '123456'
https://jazz.intranet.xx.com/ccm/resource/itemOid/com.ibm.team.workitem.query.QueryDescriptor/_EG5I8pzfEeOsZYheQqjNwg?_mediaType=text/html&jsonParameterValues=%7B%22com.xx.workitem.attribute.old_wi_id3%22%3A%7B%22attributeId%22%3A%22com.xx.workitem.attribute.old_wi_id%22%2C%22operator%22%3A%22is%22%2C%22values%22%3A%5B123456%5D%7D%7D&nocache=1395840685618

0 votes


Permanent link
I know that this is not good work around, but you can run unparametrized query and iterate over results to fetch work items matching your params.

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

Question asked: Mar 26 '14, 7:47 a.m.

Question was seen: 6,839 times

Last updated: Apr 01 '14, 10:34 a.m.

Confirmation Cancel Confirm