JIRA Structure - creating a formula column to count number of linked duplicates

pritchsc December 23, 2022

Hi all, 

Looking for any pointers here/help on how to create a formula using structure 7.3 that will count the number of linked Issues that are "is duplicated by". I'm working on a proxy metric to help with business prioritisation. 

After reviewing the help guide. I stumbled across the following example, that I hoped would provide a list of "duplicates" from which I could count. Unfortunately, this code does not present any response, nor does it display an error on those issues that have been marked as duplicate. Maybe it is working, just not providing an output as thought. 

WITH _format(issue) = """[${issue.key}|${issue.url}]""" : issuelinks .FILTER($.type = 'Duplicates' AND $.destination = this) .MAP(_format($.source))

Any help as to why above is not working, and suggestions to achieving the count of the duplicate issues would be much appreciated. 

 

 

1 answer

1 accepted

3 votes
Answer accepted
Phil Heijkoop
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 29, 2022

Hi there,

Phil here, with the Tempo team that created and support the Structure product. That's a really clever example formula you've found, though it may be so clever it's hard to decipher and work with if you aren't a seasoned Expr pro.

It seems that you're looking to create a formula column that just returns the amount of issues linked to each source issue for a given link type. We could write that as follows (and I'll break down what each step means after):

SIZE(issuelinks.filter($.type="duplicates").filter($.source=this))

What we're doing here is the following.

Let's look inside the SIZE function first, where we are going to grab an array of all the issuelinks for this issue. We are then going to filter this array twice since we don't want ALL the issuelinks, the first filter says "I want only the issuelinks that are of the 'duplicates' type". The second filter says "I only want the issues that originate in this issue", we should remember that all issue links have 2 issues involved, a source and a destination. This leaves us with an array of all the issuelinks that meet this criteria, so we then do a SIZE operation on this array, since we just want to know how many of these there are.

 

Let me know if that helps or if you have any followup questions.

Best,

Phil Heijkoop

Head of Product Solutions

Tempo

pritchsc January 2, 2023

Thanks very much - super helpful. 

Like # people like this
Marijn Plat October 27, 2023

this is pretty cool. I'm getting stuck in trying to apply in my structure. I have a structure with linked items, duplicates, implements, the works.
I'm thinking my fault is in declaring 'this'. I've declared it to be 'Key' , but I'm guessing it should be the object instead?

How should I declare it?

Pierre Walhin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 3, 2024

Hi, I seem to have the same issue but I suspect it is because I am using the cloud version of Structure, and "this" is not supported according to this page. How would we work around it ?

Stepan Kholodov _Tempo_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2024

@Marijn Plat @Pierre Walhin 

There is indeed no this function in Structure Cloud yet; using key instead in the same formula can work too.

I hope this helps. If you need help with the formula or anything else, please reach out to us directly at our support portal.

Best regards,
Stepan
Tempo (the Structure app vendor)

Pavan Cheruvu February 21, 2024

The answer is very useful to me, as I have similar issues. The explanation you gave under "What we're doing here is the following." is exactly what I needed !

Thanks a ton @[deleted] khodolov

 

Like Stepan Kholodov _Tempo_ likes this

Suggest an answer

Log in or Sign up to answer