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")
How can I build an expression which has nested AND/OR conditions
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
Accepted answer
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
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
Comments
Karthik Krishnan
Aug 28 '15, 11:36 a.m.ignore the variable names :)
Karthik Krishnan
Aug 31 '15, 1:47 a.m.Karthik Krishnan
Aug 31 '15, 9:49 a.m.Is this possible at all via API?