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

Mikes Trello Tips - Automation to truncate a numeric custom field

Mikes Trello Tips

Every other Friday, I am going to put up a Trello tip that I hope you will find helpful and will inspire your Trello creativity.

Anything is possible in Trello, if you use your imagination 😀

 I will alternate between automation and general Trello tips and happy to take requests...

This week, I will take you through how to use RegEx and Automation to truncate a numeric field...

ezgif.com-video-to-gif (4).gif

 

A little mention for RegEx

You can take Trello automation to new heights with RegEx...

It is supported but very little is written about this mysterious feature...

If you're new to RegEx or haven't scripted/coded before, it can be a little daunting...
Screenshot 2023-06-09 134216.png

If you want to learn more about RegEx, there are some great YouTube videos and I recommend these two sites:

This is a great site for learning about it: 

https://www.rexegg.com/

And this is the go-to place to test out your regex search before putting it into a Trello automation command:

https://regex101.com/ 

Top Tip 1: Always get the regex expression right in the editor before putting into a Trello command.

Top Tip 2: Google what you are looking for, easier than learning to construct yourself, almost every common example you can think of has a thread on stackoverflow. 

 

How to truncate a numeric value 

I have 3 automations to set number custom fields to truncate to:

  • No decimal place
  • 2 decimal places
  • 4 decimal places 

Note: This will not round the numeric value up or down, merely trim away the unwanted digits...

Lets start...

When using regex in Trello, you always have to start with regex:/ followed by the RegEx query, and a / to close it out.

1) No decimal place:

when custom field "No decimal Place" is set to "regex:/(\d*)\.\d*/", set custom field "No decimal Place" to "{wildcard1}"

Screenshot 2023-06-09 144739.png

2) Two decimal places:

when custom field "2 Decimal Places" is set to "regex:/(\d\.\d{2})\d*/", set custom field "2 Decimal Places" to "{wildcard1}"

Screenshot 2023-06-09 144500.png

3) Four decimal places:

when custom field "4 Decimal Places" is set to "regex:/(\d\.\d{4})\d*/", set custom field "4 Decimal Places" to "{wildcard1}"

Screenshot 2023-06-09 144511.png

 

As you can see from example 2 and 3, you only have to change the number inside the {} to set the number of decimal places to your choosing...

4 comments

Krimo Khermane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2023

@Dreamsuite Mike Great article! I rely on ChatGPT for regex to save time and effort. It's a helpful tool when I'm feeling a bit lazy.

Dreamsuite Mike
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2023

@Krimo Khermane I didn't think of that, how often does it get it right?

Like Krimo Khermane likes this
Summer.Hogan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 9, 2023

@Dreamsuite Mike - great tips! Thanks so much! 

Krimo Khermane
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 12, 2023

@Dreamsuite Mike simply describe the issue or your desired outcome, and specify that you require assistance with a regular expression (RegEx). ChatGPT will provide you with the appropriate solution swiftly, always double-check though.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events