Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,665
Community Members
 
Community Events
184
Community Groups

Why are my numeric values summed in my smart value if else statement

Edited

Hi everyone

 

I'm trying to provide a numeric score against different types of values submitted in a custom field, e.g, when 'effort' is marked as XXS the value should be -0.25 but when it's marked as XS it should be a value of -0.5 etc. I have written the following code for an automation but when I have anything more than the first row the result is always a sum of the values, i.e. -0.75 (-0.25 +-0.5). What am I doing wrong?

 

{{#if(equals(epic.Effort,XXS))}} -0.25 {{/}}

{{#if(equals(epic.Effort,XS))}} -0.5 {{/}}

 

Many thanks

2 answers

Hey John

 

Thanks so much for coming back to me. Screenshot attached:Screenshot 2022-09-06 at 09.41.56.png

I know I could use the drag and drop 'if else' that jira automation uses but I have many, many of these rules to operate and, in the end, to sum the results of. I believe it's more efficient to code it (if it works).

 

Many thanks

Emma

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 03, 2022

HI Emma,

Can you share the entire rule that you have so far?

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 07, 2022

I have not tried two different values for a single variable like that before. Make create two separate variables and use conditions to check if each is > 0  or not.

Hi John.

No worries. I appreciate the response anyway and am pleased to tell you I have a solution. I got my head together with a magic office fairy who was able to come up with this solution:

{{#math}}
IF({{issue.Effort.value.indexOf("XXS")}}=0,-0.25,0) +
IF({{issue.Effort.value.indexOf("XS")}}=0,-0.75,0) +
IF({{issue.Effort.value.indexOf("S")}}=0,-1,0) +
IF({{issue.Effort.value.indexOf("M")}}=0,-2,0) +
IF({{issue.Effort.value.indexOf("L")}}=0,-3,0) +
IF({{issue.Effort.value.indexOf("XL")}}=0,-4,0) +
IF({{issue.Effort.value.indexOf("XXL")}}=0,-5,0) +

IF({{issue.Impact.value.indexOf("S")}}=0,0.25,0) +
IF({{issue.Impact.value.indexOf("M")}}=0,0.5,0) +
IF({{issue.Impact.value.indexOf("L")}}=0,1,0) +
IF({{issue.Impact.value.indexOf("XL")}}=0,2,0) +
IF({{issue.Impact.value.indexOf("XXL")}}=0,3,0) +

IF({{issue.Confidence in achieving the impact.value.indexOf("0-50%")}}=0,0,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("50%")}}=0,1,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("80%")}}=0,2,0) +
IF({{issue.Confidence in achieving the impact.value.indexOf("100%")}}=0,3,0) +

IF({{issue.Cost of delay.value.indexOf("A slap on the wrist")}}=0,0.5,0) +
IF({{issue.Cost of delay.value.indexOf("Should really do this")}}=0,1,0) +
IF({{issue.Cost of delay.value.indexOf("This is a big deal")}}=0,2,0) +

IF({{issue.No miss.value.indexOf("Yes")}}=0,100,0) +

IF({{issue.Strategic Roadmap.value.indexOf("Directly supports the strategic roadmap")}}=0,6,0) +
IF({{issue.Strategic Roadmap.value.indexOf("In part supports the strategic roadmap")}}=0,4,0) +
IF({{issue.Strategic Roadmap.value.indexOf("Very lightly supports the strategic roadmap")}}=0,2,0) +
IF({{issue.Strategic Roadmap.value.indexOf("Nope. This doesn't a support it (kudos for honesty)")}}=0,2,0) +

IF({{issue.Target Date.value.indexOf("3 months")}}=0,3,0) +
IF({{issue.Target Date.value.indexOf("3-6 months")}}=0,2,0) +
IF({{issue.Target Date.value.indexOf("6-9 months")}}=0,1,0) +
IF({{issue.Target Date.value.indexOf("Not applicable")}}=0,0,0) +

IF({{issue.Tech Debt.value.indexOf("Adds Tech Debt")}}=0,-1,0) +
IF({{issue.Tech Debt.value.indexOf("No impact")}}=0,0,0) +
IF({{issue.Tech Debt.value.indexOf("Remove tech debt")}}=0,1,0) +

IF({{issue.What's the reach?.value.indexOf("0-10%")}}=0,0.25,0) +
IF({{issue.What's the reach?.value.indexOf("10-25%")}}=0,0.5,0) +
IF({{issue.What's the reach?.value.indexOf("25-50%")}}=0,1,0) +
IF({{issue.What's the reach?.value.indexOf("50-75%")}}=0,1.5,0) +
IF({{issue.What's the reach?.value.indexOf("75-90%")}}=0,2,0) +
IF({{issue.What's the reach?.value.indexOf("90-100%")}}=0,3,0)
{{/}}

Each of the sections represents a different field I was giving a value to. The formula breaks down as follows with each variable being pre/suffixed with an asterisk:

IF({{issue.*fieldname*.value.indexOf("*value*")}}=0,*Lookupvalue*,0)

This section: indexOf("*value*")}, looks up the value and returns its first character position. Given that am looking for the full value I know that its position must be 0 for it to be what I'm looking for. I determine this here: indexOf("*value*")}}=0. When that is true it returns the lookup value or zero if it's false. That means adding them together gives me the total sum. Currently, this will not work if someone leaves a null value, i.e they deleted the field's contents. I may have to ask for some more help from my magic fairy...

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 03, 2023

Hey @Emma Bates  - did you ever get this working? 

Hi John

 

Yes, indeed! See my last post above. This did what I needed it to do very well.

 

Thanks

Emma

Like John Funk likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events