Default value for timestamp field
Options
Luck Kanthatham-2308338
Member ✭
First of all, I just want to thank you for your product and service. Keep doing what you're doing.
Now to my request. It would be nice to have the option of setting the default for the timestamp field to be "now". This way whenever the record is touched this field can be used to log the time. Right now it has to be done through code.
Now to my request. It would be nice to have the option of setting the default for the timestamp field to be "now". This way whenever the record is touched this field can be used to log the time. Right now it has to be done through code.
Comments
-
- this is already supported. "now" is available in the function stack to always set a timestamp to the current time.
-
You can also default this in the schema, just make sure the field is not nullable.
[CleanShot 2022-01-21 at 15.20.50.png] -
Ah, thanks. I didn't know about the nullable "no" thing.
-
Sorry I have to make a follow up to this but I noticed that the field is not updated if I create a new record through code. This only works when I create a new record in the table view.
-
- can you provide some screenshots? It seems to be working as expected for me
-
Actually, just tested again and it seems to be fine. Thanks again.
-
Circling back to this. Seems like it works when a new record is created. However it doesn't work if the record is edited.
[Screen Shot 2022-01-27 at 18.32.50 PM.png]Before editing
[Screen Shot 2022-01-27 at 18.36.32 PM.png]After[Screen Shot 2022-01-27 at 18.36.09 PM.png] -
I think you are assuming that if you edit a field directly in the spreadsheet view that the other field would somehow get updated. This is not the case.
What you should do is update the record through the API and have your last_updated field take in a "now" timestamp.
The spreadsheet view is purely for raw data entry. -
I see. I have been doing that but thought it might be more automatic if I don't have to always remember to do that. Thanks.
Promise I won't add anymore to this thread. 🙂
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback