Forums

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

JIRA smart-value math equals in IF not working

Leeland
Contributor
August 31, 2021

I can't figure out why this isn't working with the IF. According to the online docs, equals returns a true or false but the {{math}} smart-value IF condition isn't accepting it.

 

{{#math}}
IF({{equals(issue.Advisement Type,"Post Production Gap Analysis")}},40,0)
+ IF({{equals(issue.Advisement Type,"Content changes")}},40,0)
{{/}}

 

"Advisement Type" is a custom bullet selection list.

 

The error I'm getting is:

Error rendering smart-values when executing this rule:

Function IF expected 3 parameters, got 2: IF(,40,0) + IF(,40,0)

2 answers

1 accepted

1 vote
Answer accepted
Leeland
Contributor
August 31, 2021

For whatever reason, there is no string comparison support in the `{{math}}` function. So I solved this with a brute force method to turn the result into a numeric comparison.

 

{{#math}}
IF({{issue.Advisement Type.value.indexOf("Post Production Gap Analysis")|-1}}>=0,40,0)
+ IF({{issue.Advisement Type.value.indexOf("Conceptual Review")|-1}}>=0,40,0)
{{/}}
0 votes
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.
August 31, 2021

Hi @Leeland 

That looks like your custom field is collapsing to null, and taking the equals() test with it.

Have you tried adding a .value to the end of your field to confirm a value is being used?

{{#math}}
IF({{equals(issue.Advisement Type.value,"Post Production Gap Analysis")}},40,0)
+ IF({{equals(issue.Advisement Type.value,"Content changes")}},40,0)
{{/}}

Best regards,
Bill

Leeland
Contributor
August 31, 2021

Hello @Bill Sheboy,

I tried that and it didn't work. But the documentation is light for the single list select access. I didn't know about the ".value" for that. Prior attempts showed that the join() and indexOf() method didn't work. But, using .value the indexOf worked. So I solved this with the brute force method.

{{#math}}
IF({{issue.Advisement Type.value.indexOf("Post Production Gap Analysis")|-1}}>=0,40,0)
+ IF({{issue.Advisement Type.value.indexOf("Conceptual Review")|-1}}>=0,40,0)
{{/}}

 

Thanks for the hint!

+ Leeland

Like # people like this
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.
August 31, 2021

I am glad to learn you got it to work!

Like Leeland likes this

Suggest an answer

Log in or Sign up to answer