Size of cascade list (select list - cascading)

l.vosahlo July 29, 2021

 

Hi All,

I am using custom field (select list - cascading), for example values bellow:

Client1Environments (parent)
    Env1
    Env2
    Env3
    Env4

Client2nvironments (parent)
    Env1
    Env2

size of Client1Environments = 4

size of Client2Environments = 2

Problem: How can I get size of the parent? I tried to use {{Client1Environments.size}}, however it gave me nothing. If i use {{Client1Environments.child.value}} it will return me the selected value in ticket, which i can the use for further processing, however i need to get the number of how many Env is in the list.

Thank you for your help!!

1 answer

1 accepted

1 vote
Answer accepted
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 29, 2021

Hi @l.vosahlo ,

welcome to the Atlassian Community!

I don't think it's possible. Please, what are you trying to achieve? Why do you need this information?

l.vosahlo July 29, 2021

first off all thank you for your answer!

For example lets assume that our parent is following (it is vary according to client):
Client1Environments (parent)
    Env1
    Env2
    Env3
    Env4

 

myVariable = size of parent (in this case 4)

myCurrentEnvironmentId = {{#increment}}{{issue.Increment}}{{/}} (velue will be automatically increase per each iteration, in this case we know we have to run it 4times)

 

IF {myVariable != myCurrentEnvironmentId} (Do something else then ussual)

Basically, we are tusing JIRA for automatick deployment and this task can help us to handle our target environment:-)

I hope it is clear, if not let me know I will try to make better description.

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 29, 2021

The "size" of any cascading select list field is either 0 or 1.  0 means it is empty, 1 when it is not.  A cascading select can only ever have one value in it (even though that value can be a key pair, it is still only one value).  Imagine a custom field that has country/city lists in it - you can't set it to UK/London, US/San Francisco and Spain/Barcelona at the same time, it can only ever have one value.

I think what you're looking for is the *administration* data that there are X/Y options available, which is not something you would use in an automation.

I think you might be using the wrong type of field for this.  Maybe it should be a multi-select?

l.vosahlo July 30, 2021

@Nic Brough -Adaptavist- I definitelly agree that value can have only one value (when selecte) - just to let you know, I am able to extract this value {{IssueName.child.value}}.

However, I was hoping that i would be able to take a parent as my Array and then use some loop (like in other language - BUT I fully understand i am using JIRa for something different that should be used:-))

I am going ask you one more question. Lets say I would like to print in the log 2nd value in the Client1Environment (which is Env2) - When i use {{Client1Environment.child.Value.get(1)}} it will return nothing. is there any command i can use? 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2021

I'm not sure where you're trying to do this, I wouldn't expect an automation/smart value to go into a log

l.vosahlo July 30, 2021

yes, you are right I am using Jira Automation - smart Values - I will attach some images

right side of image showing the details of my Select List (cascading) - Parent is automatically pick according to project name.

I tried those and none of this working for me:

.first()
.last()
.get(n)

 

I was hoping that command {{HMSEnvironment.child.get(1)}} will make a lookup in to the list and return me for example HMS Harry - Env2, but my log is empty, when rule is tested.

image.png

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 30, 2021

Ok, you're still thinking of the cascading select as holding more than one value, which they do not.  They have three possible single values:

  • Empty
  • Primary + Secondary (empty)
  • Primary + Secondary (with a value)

You can get at the primary and secondary separately, even though it's still a single value.  Try

{{issue.fields.Cascade.value}}
{{issue.fields.Cascade.child.value}}
Like Hana Kučerová likes this
l.vosahlo July 30, 2021

Ok, got it - will try to use different type! I think we can close this topic! :-)
Thank you for help!

Like Hana Kučerová likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events