Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Smart Values with decimal, Format Variable to have a decimal

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

Hi @estrella.briones 

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

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.

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.

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

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
Community showcase
Published in Apps & Integrations

Marketplace Partner Spotlight: Fine Software

Happy New Year, everybody! What better way to kick off 2022 than with a new Marketplace Partner Spotlight ✨ This month, we're getting to know Daniel Franz, co-founder of Fine Software. Fine Software ...

430 views 2 15
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you