Revisiting Saving Empty Date Fields to Retool Database

Is Bradley's very smart solution here still the only way to save empty date values to the Retool Database? Having to do this is tedious and makes the much easier approach (just saving the entire form.data object) unusable. Is a fix in the works?

Hey @haj, it's not the only way, but conceptually things haven't changed. You still need to ensure that you are either sending NULL back to the DB or not sending the key for that empty date value at all.

If you are using a form and don't want to explicitly set the values for each individual column like in the previous post, you can use a pretty simple JS query to make the adjustments.

Here, I'm deleting that key from the form data object so that it just isn't sent back to the DB, but you could just as easily set the value to NULL. It's pretty easy to set up, and utilizes the form data.

Let me know if you have any questions!

1 Like