Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,424
Community Members
 
Community Events
176
Community Groups

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

Like Miguel Angel De León likes this

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

Atlassian Community Events