Forums

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

Comparison between varaibles and numbers

Martina Mulino
Contributor
August 1, 2024

Hello!

I'm using the automation functionality and I tried to use the "Create value" action to save a variable and compare it with a number but it does not work.

Here is the smart value in the variable TotalComplexity:

{{#=}} {{#if (issue.Deal type.isEmpty)}} 0 {{/}} {{#if(equals(issue.Deal type.value,"Private offering, budgettary RFI"))}} 1 {{/}} {{#if(equals(issue.Deal type.value,"RFP (private tender)"))}} 2 {{/}} + {{#if(equals(issue.RTI composition.value,"No RTI"))}} 1 {{/}} + 0 {{/}}

And here is the comparison code I've written:

{{#if ( {{TotalComplexity}} >= 1 )}} HIGH {{/}}

What am I doing wrong?

Thank you,
Martina

2 answers

1 vote
Martina Mulino
Contributor
August 1, 2024

This is how I solved the problem:

{{#if ( TotalComplexity.asNumber.gte(30) )}} HIGH {{/}}

0 votes
Rudy Holtkamp
Community Champion
August 1, 2024

Hi @Martina Mulino and welcome to the community,

First of all, I would loose the spaces within the TotalComplexity variable and I don't understand why you start with a math ({{#=}}) smart value. And I don't know why there is a +0.
I would do it like this:

{{#if(issue.Deal type.isEmpty)}}0{{/}}{#if(equals(issue.Deal type.value,"Private offering, budgettary RFI"))}}1{{/}}{{#=}}{{#if(equals(issue.Deal type.value,"RFP (private tender)"))}}2{{/}}{{#if(equals(issue.RTI composition.value,"No RTI"))}}+1{{/}}{{/}}

this should result in a value 0,1,2 or 3. Check this by adding a audit log

Then for your comparison code use:

{{#if(TotalComplexity.AsNumber.gte(1))}}HIGH{{/}}             ->(see math expressions)

 

Kind regards,

Rudy

Suggest an answer

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

Atlassian Community Events