It's all about the answers!

Ask a question

Code Review Export using SCM Tools for Snapshot


vinitha dsouza (87843) | asked Mar 06 '19, 10:04 a.m.
Hello Team,
i have before raised the same question ,below is the link

We have snapshot and retrieving 100's workitem.
Can you just give an example on how can i build a query with these work items ids and then pass to cli command for export.


Thanks

One answer



permanent link
David Lafreniere (4.4k7) | answered Mar 06 '19, 11:44 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
You'd have to write a work item query which picks up all those work items somehow. Perhaps they all have a particular "Planned For" period? Or perhaps you write a script which goes through all those work items and sets a tag such as 'in_snapshot_x', then write a work item query to find work items with that tag?
Otherwise there's no way to do this (work item code does not know anything about scm snapshots...)

Comments
vinitha dsouza commented Mar 07 '19, 4:36 a.m.
yes, i have logic to get the workitems from the snapshot. Now my query is,
we are seeing 100+ workitems.In UI, i can build query with id's of workitems with or condition. How can i do the same behaviour programmatically?
i would like to have,
OR
id -1001
OR
id -1002
But when with below code i get when i see in UI,
id -1001,1002,1003
which results in exception because it reached max length
code:
      Term queryTermOperator = new Term(Term.Operator.OR);
      for (IWorkItemHandle eachWI : workItems) {
          IWorkItem workItem = auditableCommon.resolveAuditable(eachWI, IWorkItem.FULL_PROFILE, null);
          queryTermOperator.add(new AttributeExpression(idAttribute, AttributeOperation.EQUALS, workItem.getId()));
        }

Could you please help here

vinitha dsouza commented Mar 07 '19, 6:08 a.m.
error which we have got is below,
com.ibm.team.repository.common.validation.PropertyConstraintException: Validation errors for item: type = QueryDescriptor, itemId = [UUID _4QPacBmyEemRA9oS-YkAFQ]
        Value of attribute "internalExpression" is 100022 bytes, which is greater than the allowed encoded length of 32768 bytes.

David Lafreniere commented Mar 07 '19, 10:12 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
I'm not on the Work Items team, so I can't help you here.
I suspect you won't be able to create a query with that many expressions.
(maybe build up multiple work item queries?)

Your answer


Register or to post your answer.