Conditional Trigger Formulas

Hey everyone,

I have a field that auto-populates via a trigger formula, but that will often be “over-written” manually. I’m hoping to find a way to kind of “lock” records upon a certain condition such that their trigger formulas don’t trigger, and the manually-entered values aren’t erased.

This is where my brain first went and kind of explains what I want to happen:

if condition:
  return $SomeOtherField
else:
  return $ThisField

But then I end up with circular logic since it doesn’t work the same as a transform.

To sum up, if the condition is not met, I don’t want the value to change/update from whatever was manually entered into the cell.

Any ideas?

TIA!

1 Like

Hi Parker,

Check out this example:

https://public.getgrist.com/8yjH1dY4tpZW/Community-1098/p/1

I set up the Trigger Formula column with the following trigger formula:

if $Number == 2:
  return $Example
else:
  return value

This trigger formula applies on changes to both the Number and Trigger Formula columns.

If the value in the Number column is updated to a value other than 2, the value in the Trigger Formula column remains as the value that was there before the Number column was updated. The value in the Trigger formula column is also still editable.

If the value in the Number column is updated to 2, the value in the Trigger Formula column will update to the value in the Example column. If you try to change the value now in the Trigger Formula column, you will not be able to update it.

If the value in the Number column is updated from 2 to some other value, the Trigger Formula column will be editable again.

2 Likes

Ahhh, perfect! I didn’t think of using value

Thanks so much!

1 Like