Calculate simple formula using Automation - help
Asked by Patrick Welsh:

Hi, I want a custom field on card to show a calculated formula based on numbers in other custom fields on the same card, but am struggling to make it work. I'd welcome any advice.

Using 'Rules' I have the following

when a card is added to the board, set custom field "Volume" to "{{%Width}} \* {{%Length}} \* {{%Thickness}} \* {{%Volprice}} / 1000000000"

My aim is to calculate the price of a piece of timber based on its 3 dimensions x our GB ?rate per m3, divided by a million because the numbers are enter in millimetres. I am confident that the names of the fields are correctly spelled and capitalised.

I am also unsure what the right trigger is because i would ideally like the figure to update if one of the fields is amended, rather than just when it's first added.


Answers:
author: Hannah Humbert - Simpla Workflows
body: [@Patrick Welsh](/t5/user/viewprofilepage/user-id/4669075) I would recommend changing the trigger. When you create a card, obviously these values will be empty, so there is nothing to calculate.   

Is there typically a cadence in which the fields are populated? For example, let's say "Volprice" is always the last field to be populated and you'd like the calculation to commence once this field has been set, then you could have the trigger say "when custom field "Volprice" is set....". The term "set" applies to when a field is populated for the first time or changed.  

If there is no cadence to how you're populating these fields and you'd like the "Volume" field to be calculated when any of the fields are populated, then I'd recommend using regex to create an "OR" statement in your trigger. This will be useful if any of the fields are changed as it will recalculate the "Volume" field.

```
"regex:/.*(Width|Length|Thickness|Volprice).*/"
```

This is a bit more of an advanced Trello topic so happy to answer any follow-up questions or organise a screenshare.

comments: author: Patrick Welsh
body: Hi Hannah,

Thanks so much for your quick response. This regex stuff looks a little scary so I reckon a screenshare would be very helpful.

Just to provide a little context - I am trying to find a way to enter data about individual planks of wood which we process so that we can print labels for each plank with info about each - dimensions, species, price etc.

Working backwards, i have a label printing solution which can link to a data source so I can print labels in batches. I plan to use excel. My idea is to use trello to create a card for each plank, and connect it to excel using zapier. But I want the card to auto calculate the price for each board as the team enter the information. Hence, my question to you. An alternative is to use FastFields which i have already set up and linked to zapier. But the team is familiar with trello so it might be better if I can replicate the auto calc functionality.

I am in the UK just so you know. Thanks Patrick


author: Hannah Humbert - Simpla Workflows
body: Hi [@Patrick Welsh](/t5/user/viewprofilepage/user-id/4669075) sorry for the late response! Thanks for adding more context. I'd be happy to offer a free 30 mins. You're welcome to book me via my website: <https://www.simplaworkflows.com/> or, if you can't find a time that suits, you can email me hannah@simplaworkflows.com. I'm based in NZ, so our working times are a bit opposite! It would have to be early morning or evening I believe.


Tags: cloud

trello-cloud