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

Butler: rounding float values

Kartturi February 4, 2021

When using simple arithmetic equations with Trello butler, is it possible to round a resulting float value into an integer or at least a float with fewer decimals?

Example:

Custom fields Effort and Impact with values 3 and 10 respectively.

Butler equation:

set custom field "Priority" to "{{%Impact}} / {{%Effort}}"

This sets Priority to 3.3333333333333335. Is it possible to have the result somehow formatted to 3 or 3.33?

2 answers

1 accepted

1 vote
Answer accepted
Lara
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 9, 2021

Hi Kartturi,

Thanks for reaching out!

At the moment, there isn't a way to round float values using Custom Field arithmetic.

If it helps at all, when you view the card on the board, it'll show the Priority field as 3.333:

Image 2021-02-10 at 12.59.54 pm.png

That said, I understand how this could be helpful, so I've flagged this as a feature request with the product team – let me know if there's any additional info you'd like for me to send their way!

If you're curious about how our team decides on what requests we work on, this article gives some insight into that process: http://help.trello.com/article/724-submitting-feature-requests-for-trello. We've also published a blog post with more detailed and visual information here: https://blog.trello.com/feature-requests-unite-support-and-product

If you'd like to see our latest features and releases you can take a look at our dev board at http://www.trello.com/dev. Our mobile boards are available at https://trello.com/b/5tj4qAvo/trello-ios-app and https://trello.com/b/ud59t1fL/trello-android-app.

All the best,

Lara
The Trello Team

0 votes
Andy McAfee February 21, 2022

@Kartturi @Lara @Xavier Lecomte @Antonio Panea @Lee Nesbitt @David Bakkers 

 

I found a solution for this "rounding custom field values" scenario. I can't say that it is elegant, but it is technically a work-around.  Here are my custom rules that may give you an idea for how to implement something similar for your needs. Note that my scenario needs rounding to nearest whole number so you should be able to adjust the "+ 0.5001" factor as needed (see commands below).

Problem: Custom field value needs to be rounded to nearest whole number.

Solution: Adjust the custom field value by an amount that will equal the desired value once everything to the right of the decimal place is truncated, and then truncate as needed. I accomplish this by adding .5 to my value (which needs to be 0.5001) to ensure that I do not end up with a whole number value. Also, for some reason, value needs to include the "0" to the left of the decimal. Then I store this value in my card description. Then I pull this value as a wildcard from my card description and replace my custom field value excluding everything to the right of the decimal place. Then I restore my card description's value. This effectively equates to rounding via an alternative route. Here are my Butler commands. (I am still figuring out Butler constraints/possibilities, so there may be a cleaner way to implement this).

 

1. when custom field "BenefitScore" is set in a card with custom field "VEScore" set, set custom field "VEBenefitScore" to "({{%VEScore}} * {{%BenefitScore}}/100) + 0.5001", set the card's description to "{carddescription}\n\nREMOVEAFTERVEBenefitScore:{{%VEBenefitScore}}REMOVEBEFORE", and clear custom field "VEBenefitScore"

2. when the description of a card with custom field "Benefit" set contains "VEBenefitScore:{*}.", set custom field "VEBenefitScore" to "{wildcard1}" 

3. when the description of a card contains "REMOVEAFTER", set the card's description to "{textbeforematch}" 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events