Multi Option Toggle Buttons

Hello,
I’m relatively new to Grist but loving the platform so far. I wanted to share something I’ve worked out and hopefully someone finds it useful.

My Use Case:
I own a flower shop and I am using Grist to built out an inventory tracking system to keep track of how many flower stems are in my cooler. It’s easiest to use a tablet for this for portability.(The Grist mobile interface is actually quite good, especially compared to Airtable). Entering Data through a touch screen keyboard can be a real pain, even a choice dropdown can slow me down. I have dozens of items so the less touches in the workflow the better. my idea is to have some buttons that update the inventory number.

The Solution (So Far):
I’ve been able to use Grist’s Trigger Formulas to set this up. The “Buttons” are individuals columns of type “Toggle”. I prefer the switch format but checkbox can also work.

To make our toggles work with each other, we need each toggle column to watch the other toggle columns and then switch OFF if another switches ON. For the toggle column, setting it to 0 is false/off. So the trigger formula for a column looks like this:

image

And when toggled the columns behave like this:
GristToggle

So now I need my inventory field to react to these toggles. So let’s jump to the inventory column.
I’ll need to write an if statement in the trigger formula that handles the different switch cases. (The trigger formula needs to be watching all the toggle columns). My If Statement looks like this:

IF($Set_To_0,0,IF($Set_To_1_4,$Max_Inventory/4,IF($Set_To_1_2,$Max_Inventory/2,IF($Set_to_3_4,$Max_Inventory*.75,$Max_Inventory))))

This uses my max_inventory field and sets the value of my inventory field to be some ratio of that number based on the last pressed toggle. But really there is huge flexibility here to set this column.

This solution goes a long way in making the touch screen experience better for me when taking inventory.

I hope someone can find this useful and if there is a way to improve this, (Or a better way to do it) let me know!

9 Likes

This is very cool! Thank you @Josh_Greenplate for sharing!