JSON formatting - smart value multiply and divide

Lean Li
Contributor
February 14, 2024

Hi.

I have this JSON in my Edit issue Jira automation:

{{#=}} {{issue.customfield_15400.split("/").first.asNumber.multiply(100).divide(issue.customfield_15400.split("/").last.asNumber)}} {{/}}

I am trying to:

  • Multiply the first number in a column (eg. 10/12) with 100
  • Divide the result of the first operation with the last number of the column

In the audit log is showing only:

"Error rendering smart-values when executing this rule:
Empty expression:"
Can anybody help me with the right syntax? Thank you so much in advance!

 

2 answers

2 accepted

3 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.
February 14, 2024

Hi @Lean Li 

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected.  Those will provide context for the community to offer ideas.  Thanks!

Until we see those...

There are two forms of math expressions: inline (chaining things together with dot notation) and the longer format which looks more like a formula.  You are using both, and the outer {{#=}} and {{/}} can be removed as it appears unnecessary.

Have you tried writing the values to the audit log after the split() to confirm it works as you expected?

Kind regards,
Bill

1 vote
Answer accepted
Kalyan Sattaluri
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.
February 14, 2024

Hello @Lean Li 

I used  text field to input 12/13/14 and I was able to get below formula to work without converting to number.

{{#=}}{{issue.customfield_11302.split("/").first}}*100/{{issue.customfield_11302.split("/").last}}{{/}}

 

Can you please log to see if you are seeing the calculation done?

Lean Li
Contributor
February 14, 2024

Thank you so much! This seems to solve my problem. I will still run some tests.

Like # people like this

Suggest an answer

Log in or Sign up to answer