Time stamp update

My apology. I sent the wrong link to my sheet:
Corrected share link

What’s your event type for your trigger? Have you tried ‘On Change’ instead of ‘On Edit’ for your trigger? I use scripting sparingly and most of my scripts rely on data entered into the sheet manually, do I don’t know if I would have the same problem or not. There might be a less desirable and more complicated way to do this within the app, but try changing the trigger first. You could use a timed trigger as well, but timeliness looks to be vital for your use.

I have attempted “onChange” but apparently that must be used with a timed trigger? Apparently I’m running circles and have gotten tripped up with how to use onChange.

Are you just using a trigger with the script code itself, or are you going through the Current Project Triggers option and setting it up that way? I’ll admit, I do not use scripting a whole lot, so I’m not overly familar with all the ins and outs of what works and what doesn’t work when data is update within Glide.

Capture

I am a beginner with scripts as well. Didn’t mean to mis-represent myself.
Trying to use Current Project Triggers.

In the interest of making this work short term I’ve changed the easy Switch selection (really the best way to accomplish what I need) and turned them into Date/Time entries. Not clean as it requires a 2nd button push by the user (must click “set”) but I need it to work.

I just tried it with one of my apps where I use a form button to create a new record. That triggers the onchange and runs the script to copy the value to another sheet, so as far as I can tell, it should work. An alternative would maybe be to split your switches into seperate sheets, set up relations to those sheets and create an inline list that links to each sheet. Then when you open up the list item, you can click on the pencil to edit the switch. That will allow you to use the Date/Time special value to automatically fill in the date related to that switch. It’s a really ugly solution and your use of dates instead of switches is probably a better solution in this case. With your scenario, I would press on with trying to get the script to work with the trigger.

Thanks Jeff. I ended up giving up on the triggers. Couldn’t make it work with the Arrayforumula and referenced sheets.
I went with Date/Time value and formatted accordingly in the sheet.
Not elegant like simple on/off switches but it works and I needed to move on.

I really appreciate the help.

Maybe someday Glide will add new functionality in the future that will work for you. Or maybe you’ll come up with a new idea that will work better. Apps will always evolve. I wish you luck.

Same problem. Please revert if you have found a solution.

I have a sheet that uses onEdit(e) to write date/time when a record is changed/updated and all works as long as I update via the sheet itself. However, when I use my Glide App and edit a record, the record updates but no date/time is added or updated.

Why not use the date/time special value in glide to automatically update the timestamp on the record? Then you don’t have to mess with scripts.

If you would rather use a script, I would use an onChange trigger instead.

Jeff thanks. I am new to Glide so don’t know about the date/time special value and how to use it…that would be great as I was not wanting to use scripting.

Jeff,

Thank you. If I understand this, I must use a form. I currently have the timestamp field in my google sheet and want to update that with the date/time but not sure how to add the special value to the edit screen for that sheet? My app allows only me to update the fields that are associated with the list of 22 items that remain static. Example: EURUSD is part of a list of 22 currency pairs and each has a direction field and target and timestamp. The EURUSD portion is not editable and when I update the Direction and Target I want that timestamp field to automatically update. Hope that makes more sense. Sorry for the novice questions but promise to learn from this as I go!

Jerry

Yep, the special value columns should be available in add, edit, and form mode. Just add it on your edit screen.

Got it! Sometimes I simply make things too hard! Really loving this product!

1 Like

I have this same issue

Hi Jeff, I am developing an app which requires multiple checkboxs to be activated and when they change they need a date time stamp in the next 2 fields, the first time stamp for the initial change and the second timestamp on any further changes (last submitted times) I have 6 of these on a posts page and therefore can only use the time stamp for the submission of the post itself. The other 5 checkboxs need a unique time stamp when they are activated or changed for the first time. These checkboxs are being run from the edit screen within the glide app. l have used scripts calling the onEdit function however they only work when I edit the sheet and not when glide posts to the sheet. Can you help me find a solution that works? Thanks

Hi Johnny,

Just my idea on this, so let me summarize what I get from your case:

  • You have 1 column for a timestamp of the “initial change”
  • You have 1 column for any further changes, which will record the last time the status was changed
  • You have 6 checkboxes and need any edits in Glide reflect in the timestamp change in the sheets.

How about writing a script that:

  • Takes the timestamp from any change. If column of initial change is empty, record it to that column, let’s call it column A.
  • If column A is not empty, we then move to column B of further changes. Simply record the newly taken value to column B, whether it already had value or not (because you want to take the latest change timestamp).

Another note is it seems that onEdit does not work, as you may have noticed, but onChange does, as the people in this thread said.

1 Like

Hi @ThinhDinh here is my script. It looks for a change within the spreadsheet for True and sets the new Date. This works with onEdit however is my code needing to be adjusted as it doesnt work if I change onEdit to onChange? Thanks

function onEdit(e){
if(e.value == “TRUE”)
e.source.getActiveSheet().getRange(e.range.rowStart,e.range.columnStart+1).setValue(new Date());

}