Some other way to compare two custom fields?
Asked by JR Halchak:

So I'm starting a new weightlifting plan and Trello to manage my programs in the past, but it was pretty clunky. I got excited when I saw automation was built-in now and had finally played with it a bit. Unfortunately I've hit a road block that seems to ruin my plan.

For the sake of providing an example, say I have two lists:

* **Lifting Day** - This contains a list of exercises for the day
* **Done** - This will keep all of the completed exercises I did

Each card has 4 custom number fields: **Weight, MinReps, MaxReps,** and **Reps**. As well as a checklist for each set. (These exercises have a working weight along with a rep range, the idea is you increase the reps every session until you hit the max consistently, then you add weight and start back at the minimum reps).

I have a rule that when a card is moved from **Lifting Day** to **Done** , it will mark it's due date today and set it to complete, then copy the card back to **Lifting Day** . *This works great*.

There's another rule when **Lifting Day** gets a card copied *from* **Done** , it will clear the due date, reset the checklist items, and increase **Reps** by 1. *This also works great*.

The problem is that the **Reps** will surpass the **MaxReps** eventually. It was difficult in that rule to attempt to fix this so I started another rule. It was something like (pseudo-butler):
> When **Reps** is set on a card in **Lifting Day** to a value *greater than* {{%MaxReps}} then set **Reps** to {{%MinReps}} and increase **Weight** by 5

Much to my chagrin, it seems it's not possible to reference custom field values in those comparisons, or at least in the *greater than* one, even though they're both numbers.

I also hoped to add some calculations in the future if I need to "deload" (lower the weight by X%) but that feels less possible now too.

Using variables anywhere you want seems like a pretty necessary feature for being able to create really cool automation... but I'm wondering if there's some other way to achieve my goal?

*** ** * ** ***

**TLDR** : Is there some way to set {{%CustomField1}} to {{%CustomField3}}'s value when {{%CustomField1}} is set to something *greater than* {{%CustomField2}}? It doesn't seem like it. If not, can I request it somewhere? And is there some alternative way I'm not thinking of?


Answers:
author: milynnus
body: [@JR Halchak](/t5/user/viewprofilepage/user-id/5130592)

You are right that Trello does not handle comparison. I used to have a set of routines that returns the results for simple arithmetics and comparison by sent the variables and required operations to an endpoint. The other arithmetics it has are on dates.

comments: author: JR Halchak
body: [@milynnus](/t5/user/viewprofilepage/user-id/3947182)

That makes me sad. Do you mean you created a hosted service somewhere to take the values and return new ones to use? That sounds like a lot, but I'm a software engineer and it'd be less effort than developing my own app that's automated how I'd like this to be.

If that's what you mean, can you share anything about how the automation was setup in butler? How you passed the values to, and used the values returned from, the endpoint?


author: milynnus
body: [@JR Halchak](/t5/user/viewprofilepage/user-id/5130592)

You are right. That's the approach I had taken. The downstream automation will watch a CF.


author: Vongsawat
body: Bit late to the party but. Perhaps you can use a workaround by using a 5th custom field purely for **Calculation** ?  

When you increase **Reps** by one, also set **Calculation** to {{%Reps}}-{{%MaxReps}}. Because while you can't do arithmetic in the comparison trigger, you *can* do it in the set command.  

Then have a new rule of "When custom field **Calculation** is set to a number lower than 0, then set **Reps** to {{%MinReps}} and increase **Weight** by 5"


Tags: automation

butler

compare

custom-field

number