Forums

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

Logic with Math expression

Tomas Franco May 31, 2024

Does anyone knows whether Jira automation supports combining smartvalues with math and logic operators?

I tried to use a simple (if) with a (+) to test it but it was not behaving as expected (or lack of skillfulness on my side is also likely). Documentation is not super robust on this topic ... 

Jira smart values - math expressions | Automation for Jira Cloud and Data Center | Atlassian Documentation 

Jira smart values - conditional logic | Automation for Jira Cloud and Data Center | Atlassian Documentation

I wanted to achieve a formula that should be more or less on this level of complexity:

[0,5*[({{customfield_1}} - 1 )/4] + 0,5*MIN(COUNT({{customfield_2}}),1)]

/(1/5)*[(if:({{customfield_4}},"value1")
else if:({{customfield_4}},"value2")
else if:({{customfield_4}},"value3")
else if:({{customfield_4}},"value4")]

I started by using calculated field, the problem is that it only allow for (+)(-)(*)(/) operations, and I have a multiple-selection field that needs to be binary, 1 when anything is selected and 0 when null.

2 answers

1 accepted

0 votes
Answer accepted
Bill Sheboy
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.
June 1, 2024

Hi @Tomas Franco -- Welcome to the Atlassian Community!

Without seeing your actual rule or calculations...

Yes, math and logic operations may be combined n automation rules.  Your scenarios specifics, and how you want to use the results, may determine what is possible.

 

For example, expressions like these are possible:

{{#=}}{{issue.someField}} + 0{{#if(some condition)}}{{some smart value expression}}{{/}} {{/}}

{{#if(some condition)}}{{#=}}some math expression{{/}}{{/}}

Additionally, Lookup Tables can help to provide a key / value mapping to reduce the need for some conditionally logic:

{{#=}}{{issue.someField}} * {{tableMyTable.get(issue.anotherField)}}{{/}}

 

For more specific suggestions, the community would need:

  • What problem are you trying to solve?  What is, "why do this?"
  • An image of your complete automation rule
  • Images of any relevant conditions, branches, and actions which need the math or logic
  • An image of your audit log details
  • An explanation of what is not working as you expected

 

Kind regards,
Bill

0 votes
Fabian Lim
Community Champion
June 1, 2024

Hi @Tomas Franco

Welcome to the community!

Looks like the logic expressions are limited.  You will have to use the "if/ese" condition and on each branch include the edit action.

I hope this helps.

Fabian

Suggest an answer

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

Atlassian Community Events