It's all about the answers!

Ask a question

How to query work item's customized attribute?


Alexander Assall (1211) | asked May 07 '09, 11:50 a.m.
I have a customized attribute named 'extendStatus' and type is string. But the query by this attribute is broken. Here is the code segment.

WorkItemQueryModel model= WorkItemQueryModel.ROOT;
IItemQuery query= IItemQuery.FACTORY.newInstance(model);
IPredicate predicate = model.workItemType()._eq(query.newStringArg());
predicate = predicate._and(model.projectArea()._eq(projectArea));
predicate = predicate._and(model.stringExtensions().key()._eq('extendStatus'))._and(model.stringExtensions().value()._notEq('ARCHIVED'));

If i change the type to medium string, the query can work. My question is whether work item query model can support string extentions. If not, why stringextension exists in the model... Thanks in advance.

One answer



permanent link
Patrick Streule (4.9k21) | answered May 11 '09, 3:51 a.m.
JAZZ DEVELOPER
I have a customized attribute named 'extendStatus' and type is string. But the query by this attribute is broken. Here is the code segment.

WorkItemQueryModel model= WorkItemQueryModel.ROOT;
IItemQuery query= IItemQuery.FACTORY.newInstance(model);
IPredicate predicate = model.workItemType()._eq(query.newStringArg());
predicate = predicate._and(model.projectArea()._eq(projectArea));
predicate = predicate._and(model.stringExtensions().key()._eq('extendStatus'))._and(model.stringExtensions().value()._notEq('ARCHIVED'));

If i change the type to medium string, the query can work. My question is whether work item query model can support string extentions. If not, why stringextension exists in the model... Thanks in advance.



You have most likely defined a custom attribute of type 'string'. In the query model, this corresponds to largeStringExtensions() and is not queryable. The mapping from custom attribute type to state extensions is as follows:

'string' -> largeStringExtensions (not queryable)
'mediumString' -> mediumStringExtensions()
'smallString' -> stringExtensions()

If you need a large string field, this is still searchable via full-text query.

HTH,
Patrick
Jazz Work Item Team

Your answer


Register or to post your answer.