I’m using grist for brewery production sheets so i need to fill cells with timestamps for various actions throughout the day. I only need time, no date but i already made a topic about that matter, but here are some issues i ran into when using an action button to fill a timestamp cell. I tried those two methods :
- using a column called
$now
initialized with anow()
formula that’s triggered anytime any cell is updated and calling it with an action button like so :
{
"button":"Début refroidissement",
"description":" ",
"actions":[["UpdateRecord", "Fiches_de_brasse", $id, {"DEBUT_REFROIDISSEMENT": $NOW}]]
},
- using directly the
now()
function in the action button :
{
"button":"Début refroidissement",
"description":" ",
"actions":[["UpdateRecord", "Fiches_de_brasse", $id, {"DEBUT_REFROIDISSEMENT": NOW() }]]
},
The syntax difference is subtle and lies at the end of the "actions"
line.
Here are the issues, respectively :
- this method works almost fine, but since the
now()
function is triggered at each cell update AFTER the button’sUpdateRecord
action is taken, each action button needs to be double clicked to be sure that the timestamp is correct. For example : no cell has been updated in an hour (so the$now
contains the time and date from an hour ago), i click the action button, time and date from an hour ago gets pasted in the targeted cell,$now
cell is updated with the current time and date. I click again, the pasted time and date is now correct. So this works, but the need for a double click is counter intuitive and not practical. - including the
now()
function in the action buttonActions
line pastes the same timestamp, whatever time it is. I feel like it is made static at very moment the action button formula is validated.
I thought about not using an action button, but there does not seem to be a direct way to fill the time part of a datetime
field, and time only fields do not exist in grist. Let me know if i’m missing something !