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

Help with Expression & Terms in RTC Plain Java API

In my Java application I am building a Query using Expressions & Term to query for Work items

One of my conditions looks like below
- Status ("Unresolved")
AND
- Filed Against ("SW" OR "HW")

Term typeinProjectArea= new Term(Term.Operator.AND);
typeinProjectArea.add(exprstates);

Term trmFilter = new Term (Term.Operator.OR);
trmFilter.add(exprFildAgainst1);
trmFilter.add(exprFildAgainst2);
IQueryClient queryClient = workItemClient.getQueryClient();
com.ibm.team.workitem.common.query.IQueryResult<IResult> results = queryClient.getExpressionResults(oProjectArea,typeinProjectArea);
In the above code I can pass only one expression
How can I build an expression which has nested AND/OR conditions

1

0 votes

Comments

ignore the variable names :)

  • bump * 

Is this possible at all via API?


Accepted answer

Permanent link
Karthik,

public class Term extends Expression

--> this means you can Term.add(anotherTerm);
So in your case:
orTerm.add(filedAgainstHW);
orTerm.add(filedAgainstSW);
andTerm.add(typeInProjectArea);
andTerm.add(orTerm);

That should do the job. If this answers your question please mark it as accepted.

gg,
Arne
Karthik Krishnan selected this answer as the correct answer

2 votes

Comments

Thanks Arne,

Just found that by myself (I had a look at the API document closely and figured out that)


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
× 10,936
× 233

Question asked: Aug 28 '15, 11:30 a.m.

Question was seen: 3,202 times

Last updated: Sep 01 '15, 4:04 a.m.

Confirmation Cancel Confirm