Queries in RTC
I am trying to write a query which fetches work items from a project area based on the filtering of Summary filed.
For E.g. say I enter the value in a text field as "hello" then all the work items in a particular project area whose summary contains "hello" should be fetched.
I am a little new to this. I tried few things.
How do I create a proper expression for that ?
Expression newExpr = new VariableAttributeExpression(attribute, AttributeOperation.CONTAINS,
What to pass here);
For the above expression how do I pass my Summary String ?
Thanks for any help :)
Regards,
Arshad
Accepted answer
Expression newExpr = new VariableAttributeExpression(attribute, AttributeOperation.CONTAINS, "string");
Comments
Hi Sam,
Thanks for your response,
Expression newExpr = new VariableAttributeExpression(attribute, AttributeOperation.CONTAINS, "string"); doesn't work.
Expression newExpr = new AttributeExpression(attribute, AttributeOperation.CONTAINS,
"myText"); worked for me.
I think you also meant the same :)
right ,"string" meant whatever string of text you were searching for
and you got it.. thx for the feedback
Hi Sam,
But how do I filter from a project area ?
I did this :
Expression summaryExpression = new AttributeExpression(attribute, AttributeOperation.CONTAINS, summaryText);
IQueryResult<IResolvedResult<IWorkItem>> results = queryClient.getResolvedExpressionResults(projectArea,
summaryExpression, IWorkItem.FULL_PROFILE);
But it gives me the work items from all the project areas of a repository but it filters based on the text entered.
Regards,
Arshad
you have to add another expression to the expression,
AND,
and then (projectarea)attribute equals ProjectArea