Smart Values with decimal, Format Variable to have a decimal

estrella.briones November 16, 2021

Hello,

I would like to have a decimal for the Smart Value Variable that I'm creating {{futureVersion}}.

The format should be like this:

8.90

8.99

9.00

However, when I try it to be this way, it doesn't seem to take the format that I want, it just returns blank.

{{futureVersion.format("%.2f")}}

 

Help is appreciated, thank you.

1 answer

1 accepted

0 votes
Answer accepted
Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 17, 2021

Hi @estrella.briones 

What do you get when you have only {{futureVersion}}?

estrella.briones November 17, 2021

Hello @Sebastian Krzewiński 

{{futureVersion}} is a smart variable that I created using this formula:

{{#=}}{{issue.description}}+0.01{{/}}

It correctly returns the value that I need, for example 9.

However, when I use the formula {{futureVersion.format("%.2f")}}, on another Action it doesn't return anything, it is left blank. If I remove the suffix .format("%.2f"), it can print 9 so I would like to know how can I format '9' to '9.0'.

 

Thank you.

estrella.briones November 17, 2021

Hello,

I'm attaching screenshots of how I would like to make use of the futureVersion to have 2 decimal points.

I created smart variable futureVersion:

Screen Shot 2021-11-17 at 4.21.57 PM.png

Then, I would like for that variable to have 2 decimal places:

Screen Shot 2021-11-17 at 4.26.05 PM.png

 

Thank you.

Sebastian Krzewiński
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 18, 2021

Hi @estrella.briones 

 

That was though one. Unfortunately I don't have good news for you.

I made few tests and I see that problem is that your variable based on text field (description). It is weird but you can make math operations on numbers in text field but format works only with number fields. I see a workaround for you: copy number from description to number field and then make all magic or switch description to number field.

Second thing - format. Your format didn't work for me. I made some test based on this link.

I tested 3 formats (customfield_10008 is number field):

  • {{issue.customfield_10008.format("###.##")}}
  • {{issue.customfield_10008.format("00.00")}}
  • {{issue.customfield_10008.format("%.3f%n")}}

Results are:

  • for 12 options return:
    • 12
    • 12.00
    • 12.0
  • for 12.123 options return:
    • 12.12
    • 12.12
    • 12.123

Hope that this will help you and you will resolve your issue :)

 

Seba

Like # people like this
estrella.briones November 18, 2021

Hello @Sebastian Krzewiński 

 

Yes, I have the suspicion too that my variable (originated from Description) was treated as a String and not a number, that's why the format directly doesn't work *cry*

 

Thank you so much for the idea and kind help.

 

Estrella

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events