It's all about the answers!

Ask a question

Help with Expression & Terms in RTC Plain Java API


0
1
Karthik Krishnan (8899123165) | asked Aug 28 '15, 11:30 a.m.
edited Aug 28 '15, 11:33 a.m.
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

Comments
Karthik Krishnan commented Aug 28 '15, 11:36 a.m.

ignore the variable names :)


Karthik Krishnan commented Aug 31 '15, 1:47 a.m.
  • bump * 

Karthik Krishnan commented Aug 31 '15, 9:49 a.m.

Is this possible at all via API?

Accepted answer


permanent link
Arne Bister (2.6k12832) | answered Sep 01 '15, 2:41 a.m.
JAZZ DEVELOPER
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

Comments
Karthik Krishnan commented Sep 01 '15, 4:04 a.m.

Thanks Arne,

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


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.