Skip to main content
5-Regular Member
May 9, 2024
Solved

How many times has a tracker item been re-used (copied)? - Looking to generate a report

  • May 9, 2024
  • 1 reply
  • 1552 views

I am looking for a way to see how many times an item has been re-used (copied over to other projects, duplicated and reused in other trackers, etc.) in a Codebeamer system. 

 

I have managed to generate a report that returns items with the "Copy Of" Association tag, and then I do a "Group By - Summary". This lets me know a count of objects that have been copied and have the same summary, but it also returns the original copy, so the count is off by one. I was also hoping to get this count information in it's own individual column as a field on the items themselves, but I am not sure how I would go about achieving this as the act of copying doesn't seem to be an easy event to "hook" into so to speak, like a workflow action, so that we can increment a field every time an item is reused.

 

If anyone has any ideas or has achieved something similar I would greatly appreciate any input.

 

Thanks

Best answer by alfonso_c

Hi @CM_9399659 , I could not find any way so far to achieve this on Codebeamer out of the box. For example, there is currently no way to get associations via computation and I see no default workflow that could catch / keep the count of the operation. Once the copy is done, no more information about the operation is stored in Codebeamer, unless you explicitly set the Association Type. To complicate things:

 

- There can be cases where a copy is done but "None" is chosen as Association Type:

alfonso_c_0-1717142777434.png

In that case, the copied item will not have a link to the master

 

- The opposite is also true, one could manually set a Copy association between two items that have nothing in common and have been created separately

 

- The Summary can be edited later, making a report based on the title equality unreliable.

 

Always assuming the copy is done by explicitly setting "Copy Of ..." Association Type and when doing the Copy operation, one idea is that you could get the associations via Swagger REST API. Consider this example:

 

  • Master item ID is 40012
  • Copied item ID from 40012 is 5030565
  • The associations between the two are:
    • 40012 > 5030565 was copied from this item
    • 5030565 > This item is a copy of 40012 

 

You can query Associations on the master item with GET /v3/items/40012/relations. The response will be something like:

 

{
 "itemId": {
 "id": 40012,
 "version": 5
 },
 "downstreamReferences": [],
 "upstreamReferences": [],
 "incomingAssociations": [
 {
 "id": 30386829,
 "itemRevision": {
 "id": 5030565,
 "version": 2
 },
 "type": "IncomingTrackerItemAssociation"
 }
 ],
 "outgoingAssociations": [],
 "page": 1,
 "pageSize": 500,
 "itemCount": 1,
 "isLastPage": true
}

 

 

incomingAssociations says "id": 30386829, so you can query that at GET /v3/associations/30386829 with a response like:

 

{
 "id": 30386829,
 "descriptionFormat": "PlainText",
 "from": {
 "id": 5030565,
 "name": "As support person, I can easily read out firmware version",
 "type": "TrackerItemReference"
 },
 "to": {
 "id": 40012,
 "name": "As support person, I can easily read out firmware version",
 "type": "TrackerItemReference"
 },
 "type": {
 "id": 9,
 "name": "copy of",
 "type": "AssociationTypeReference"
 },
[...]

 

 

Based on this, you could develop a programmatic way to parse and count the "copy of" in the JSON and return the copied count value.

 

Other than that, why are you looking for ways to know the number of times an item has been copied? By knowing more about your use case, perhaps I or other community users can look into other alternatives.

1 reply

alfonso_c14-AlexandriteAnswer
14-Alexandrite
May 31, 2024

Hi @CM_9399659 , I could not find any way so far to achieve this on Codebeamer out of the box. For example, there is currently no way to get associations via computation and I see no default workflow that could catch / keep the count of the operation. Once the copy is done, no more information about the operation is stored in Codebeamer, unless you explicitly set the Association Type. To complicate things:

 

- There can be cases where a copy is done but "None" is chosen as Association Type:

alfonso_c_0-1717142777434.png

In that case, the copied item will not have a link to the master

 

- The opposite is also true, one could manually set a Copy association between two items that have nothing in common and have been created separately

 

- The Summary can be edited later, making a report based on the title equality unreliable.

 

Always assuming the copy is done by explicitly setting "Copy Of ..." Association Type and when doing the Copy operation, one idea is that you could get the associations via Swagger REST API. Consider this example:

 

  • Master item ID is 40012
  • Copied item ID from 40012 is 5030565
  • The associations between the two are:
    • 40012 > 5030565 was copied from this item
    • 5030565 > This item is a copy of 40012 

 

You can query Associations on the master item with GET /v3/items/40012/relations. The response will be something like:

 

{
 "itemId": {
 "id": 40012,
 "version": 5
 },
 "downstreamReferences": [],
 "upstreamReferences": [],
 "incomingAssociations": [
 {
 "id": 30386829,
 "itemRevision": {
 "id": 5030565,
 "version": 2
 },
 "type": "IncomingTrackerItemAssociation"
 }
 ],
 "outgoingAssociations": [],
 "page": 1,
 "pageSize": 500,
 "itemCount": 1,
 "isLastPage": true
}

 

 

incomingAssociations says "id": 30386829, so you can query that at GET /v3/associations/30386829 with a response like:

 

{
 "id": 30386829,
 "descriptionFormat": "PlainText",
 "from": {
 "id": 5030565,
 "name": "As support person, I can easily read out firmware version",
 "type": "TrackerItemReference"
 },
 "to": {
 "id": 40012,
 "name": "As support person, I can easily read out firmware version",
 "type": "TrackerItemReference"
 },
 "type": {
 "id": 9,
 "name": "copy of",
 "type": "AssociationTypeReference"
 },
[...]

 

 

Based on this, you could develop a programmatic way to parse and count the "copy of" in the JSON and return the copied count value.

 

Other than that, why are you looking for ways to know the number of times an item has been copied? By knowing more about your use case, perhaps I or other community users can look into other alternatives.

Community Manager
June 4, 2024

Hi, CM_9399659 

 

Did the reply by alfonso_c  help resolve your issue?  If not, please let us know so the community can continue to help you.  If so, please mark the alfonso's post as the accepted solution so it will be more findable by other community members.

 

Thank you,

 

Jaime_Lee

5-Regular Member
June 20, 2024

Yes, Alfonso's reply was helpful. Thank you Jaime.