Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to include in a structure, a column calculated containing the key of a sibling Issue.

Victor Crespo
Contributor
September 21, 2022

Hi, I am going to describe the problem with an example:

I have three projects PA, PB and PC, and PA-100, PB-90 and PC-120 are Issues of these projects that are related as :

PA-100
     Link to PB-90
     Link to PC-120

With this scenario I have defined a structure that lists the occurrences of the PB project, and I have added a calculated column with the parent key following the "Link To" relationship, ie:

PB-Key    PA-Key ...
--------------------------- ...
PB-90      PA-100 ...

...

What I want now is to add another calculated column to list the sibling Issue (the Issue with the same parent), to have a list like:

PB-Key   PA-Key   PC-Key ...
--------------------------------- ...
PB-90     PA-100   PC-120 ...

...

I have tried different schemes but in the end I don't know how to do it, I even wonder if it is possible.
Could someone help me?

 

1 answer

2 votes
Nicholas Ellis _ALM Works_
Atlassian Partner
September 21, 2022

Hi Victor,

The short answer is yes this is possible, but it did end up being rather complicated to implement.  Here is the code I came up with:

if !count_sub_items: // if we are at a leaf (no children)
with child_keys = PARENT{ array#subtree{key}.FILTER($ != this.key) }: // grab the child keys from the parents perspective
child_keys.FILTER($ != this.key) // remove this issues key from the list (leaving siblings)

 If you copy and paste this into a formula it won't recognize the first variable count_sub_items, however this is an attribute you can find from the list when you click it.  The other variables should be picked up directly.

Cheers,
Nick [ALM Works]

Victor Crespo
Contributor
September 22, 2022

Thanks Nick, but it doesn't work, at least, let's say the output is not what I expected.
What I have with this formula, following with the example, are the keys of all the PB elements present in the structure, i.e.

PB-Key    PA-Key        PC-Key ... 
-------------------------------------- ... 
PB-90      PA-100       PB-92, PB-98 ...
PB-92      PA-110       PB-90, PB-98 ...
PB-98      PA-130       PB-90, PB-92 ...

And this is not the idea. What I need in the PC-Key column, is the Key inside the PC project.

I have tried to get each parent Issue with this:

issuelinks.filter($.source.project="PA").source

And with this, I can get the second column (PA-Key), but I have not been able to access the children of the PA project to get the keys inside the PC project, that is what I need.

Cheers,

Víctor

Like Dave Rosenlund _Trundl_ likes this
Victor Crespo
Contributor
September 27, 2022

Now, I'm trying this:


With p=issuelinks.filter($.source.project="PA").source:
With q=issuelinks.filter(p.destination.project="PC").destination:
q.key

But it doesn't work, the answer is: "VALUE!"
What is the problem here?, What is wrong in this expression?

 

Regards,

Víctor

David Niro
Atlassian Partner
September 27, 2022

Hello @Victor Crespo ,

The problem with the expression was the destination will not recognize the variable p in that way. I'm not 100% sure I am clear on the goal, but perhaps this adjustment will return what you are hoping for:

with p=issuelinks.filter($.source.project="PA").source:
with q=p.filter($.destination.project="PC").destination:
q.key

Please let me know if it helps.  Please also feel free to contact our support team directly via email support@almworks.com or customer portal support.almworks.com.

Best,
David 

Suggest an answer

Log in or Sign up to answer