Toggle whole column off?

One of the many things I’m using Grist for is a packing list. Once the trip is over I’d like to be able to re-set the list so that all the toggles = false/off ready for the next trip. Is there a way I can do this?

There is a way. I just got done doing this.

  • Packing List Table

    • Item text column
    • Quantity formula column
      if $Daily:
        return int(Configuration.lookupOne(id=1).Number_Of_Days) + 1
      else:
        return 1
      
    • Packed toggle column w/trigger formula on changes to Reset_Status column.
      if ($Reset_Status):
        return False
      else:
        return PEEK($Packed)
      
    • Reset_Status formula column (hidden)
      Configuration.lookupOne(id=1).Reset
      
    • Daily toggle (checkbox)

  • Configuration Table

    • Number of Days integer column w/trigger formula on changes to Reset column.
      if ($Reset):
        return 0
      else:
        return PEEK($Number_Of_Days)
      
    • Reset toggle column

The Reset_Status column holds the reset status from the configuration table; when this changes, the Packed trigger formula is triggered to change to False and untoggling or “resetting” the field.

For the Quantity if it’s a daily item, like socks, that you need to pack a quantity of, you check Daily and it takes the number of days input in the configuration table and adds one (for a spare).

I added a Configuration card widget to the top of the page the Packing list is on, so I can toggle the reset, and input the number of days I’ll be gone.

I tried to have the Reset toggle reset itself [to false] after you set it to True but it breaks the formula in the Reset_Status column. It doesn’t really break it, but the Reset column doesn’t update in the database until the trigger formula completes, which then allows the lookup in Reset_Status to acknowledge the change. By putting a sleep or wait followed by changing Reset back to false in the trigger formula the database is never updated to show Reset=True I played with it a little but wasn’t able to come up with anything relatively simple. It’s fairly simple to just double-click the toggle to have it ready for the next time I need to reset it.

1 Like