Forums

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

Formatting smart values

Bernd Anderer
Contributor
February 5, 2024

I have this expression, that sets a Jira field:

{{#=}} {{issue.customfield_10254|0}} * {{issue.customfield_10255|0}} {{/}}

Both customefields are of type number.

What I would like to do, is to format the result of the calculation, so that it looks like this:

€ 123.234,67

or at least:

123.234,67

I am aware of this page: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#Format-numerical-values

I think I should be using something like this as a format:

€###.###,##

What I don't know is, how to add this notation

{{issue.xxxx.format("€###.###,##")}}

to the calculation

{{#=}} {{issue.customfield_10254|0}} * {{issue.customfield_10255|0}} {{/}}

 Any thoughts on that?

Thank you

 

1 answer

0 votes
Michelle Grimes February 5, 2024

@Bernd Anderer 
Hi,

You need to create both fields as variables before it goes into the final calculation. I did this for both my Inherent and Residual Risks.

Michelle

Bernd Anderer
Contributor
February 5, 2024

Hi Michelle,

Thank you for your answer.

if I understand you correctly,  I would format both fields before they go into the calculation, correct?

One issue that I want to solve, is the number of digits after the comma. I only wanna have 2 digits. 

A better example would be:

{{#=}} {{issue.customfield_10254|0}} / {{issue.customfield_10255|0}} {{/}}

 In this case, I need to apply the formatting to the result in order to get the 2 digit.

e.g. 10,00 / 3,00 = 3,34

How would your solution achieve this goal?

 

 

Michelle Grimes February 5, 2024

Hi Bernd,

That is correct - I borrowed heavily from one I found within the community answers.
 
I'm fortunate that mine are whole numbers only. You may have to go into the "Additional Fields" section and add some JSON coding or use Scriptrunner to achieve this level to get the decimals you want to be included.

This is as far as I know and I'm sorry I can't be of any further help on this,

Kind regards,
Michelle 

Bernd Anderer
Contributor
February 5, 2024

I am surprised on how terrible Jira is in terms of number formatting.

This should be implemented on the customfield level.

In addition - once I formatted the values, they become a string. Even more pain.

 

Anyway - thank you for your feedback :-) 

Suggest an answer

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

Atlassian Community Events