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

Expressions - custom attribute

 https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/


I want to get all workitems with custom value = 100;
Is it feasible ?
how ?

IAuditableCommon auditableCommon = (IAuditableCommon) teamRepository.getClientLibrary(IAuditableCommon.class);
IQueryableAttribute attribute = QueryableAttributes.getFactory(
    IWorkItem.ITEM_TYPE).findAttribute(projectArea,
    IWorkItem.PROJECT_AREA_PROPERTY, auditableCommon, monitor);
IQueryableAttribute type = QueryableAttributes.getFactory(
    IWorkItem.ITEM_TYPE).findAttribute(projectArea,
    IWorkItem.TYPE_PROPERTY, auditableCommon, monitor);

Expression inProjectArea = new AttributeExpression(attribute, AttributeOperation.EQUALS, projectArea); Expression isType = new AttributeExpression(type, AttributeOperation.EQUALS, workitemTypeID); Term typeinProjectArea= new Term(Term.Operator.AND); typeinProjectArea.add(inProjectArea); typeinProjectArea.add(isType);

</pre>

0 votes


Accepted answer

Permanent link
Note: this is a RTC question tag rational-team-concert . Jazz Foundation is totally different and few people know what it entails.


As far as I know you substitute the IWorkItem.TYPE_PROPERTY with the custom attribute ID. E.g. "id.of.my.custom.attribute".


 
IQueryableAttribute type = QueryableAttributes.getFactory(
    IWorkItem.ITEM_TYPE).findAttribute(projectArea,
    IWorkItem.TYPE_PROPERTY, auditableCommon, monitor);
E.g.
IQueryableAttribute type = QueryableAttributes.getFactory(
    IWorkItem.ITEM_TYPE).findAttribute(projectArea,
    "id.of.my.custom.attribute", auditableCommon, monitor);

It also helps when knowing how to search for examples in the SDK. See https://rsjazz.wordpress.com/2019/05/16/searching-and-exploring-the-rtc-sdk/

By the way, this is an SDK and the API is an application programming  interface that is used to create the client and the server application. It is not a special API designed to make it easy for users inexperienced with it. It is important to use available resources e.g. being able to search the SDK.  

Reverse Reverse selected this answer as the correct answer

0 votes

Comments

 it worked ..!!! thank you 


The result number are matching ..

how to print & traverse the results ?

IQueryResult<IResolvedResult<IProjectArea>> results .

hasnext fails everytime 

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,941

Question asked: Sep 25 '19, 1:54 p.m.

Question was seen: 857 times

Last updated: Sep 26 '19, 11:28 a.m.

Confirmation Cancel Confirm