Submitting a form using object .data will "" empty date values

Continuing the discussion from Problem saving empty date fields to Retool DB:

I'm facing a similar issue to the above linked. I resolved a case where I was using Key value pairs for adding a record, but am now looking at another form where I was using Insert a record using Object - {{}}

There are four optional date fields on the form. So I could switch over to using Key value pairs but would like to know if there's a simpler solution than setting up each form element and adding in the logic to convert '' to null?

Screenshot of the form for ref:

Thanks in advance :slight_smile:


You are passing in the form's .data property to a query instead of my field-by-field version?

In that case you can use this one-liner in your query's Changeset Object property (thank you ChatGPT) to convert all empty strings to null (not tested!)[k, v]) => [k, v === "" ? null : v]))`

Thanks @bradlymathews!

Got to love ChatGPT!

I tried that but no luck straight out of the box. Just checking I have the exact syntax correct. This is my whole object:

{{[k, v]) => [k, v === "" ? null : v]))}

And I'm filtering by {{ editPK.value }} which is a hidden field on the form (in a modal).

updateAccForm failed (0.202s):Empty .update() call detected! Update data does not contain any values to update. This will result in a faulty query. Table: hosting_accounts. Columns: {{[k, v]) => [k, v === "" ? null : v]))}.


There are two periods before data. Try fixing that first, it could result in that error.

Oops that's pretty embarrassing! Still get the same result with this though:

{{[k, v]) => [k, v === "" ? null : v]))}


error:"Unprocessable Entity"
message:"Empty .update() call detected! Update data does not contain any values to update. This will result in a faulty query. Table: hosting_accounts. Columns: {{[k, v]) => [k, v === "" ? null : v]))}."


Instead of inserting a null you could try omitting the "empty" properties?
something like this maybe but perhaps more logic on what you consider "empty" to be:
_.omitBy(, x => {return !!!x})

The query seems to think your column name is the code.

Send a screenshot of your query, maybe I can see what is going on.

Hey @bradlymathews,

Here's the


@dcartlidge I'll try that a bit later have to run here...

Thanks! :slight_smile:


The code is not green (you can see it is green in the filter by value above it) . No green no good! There is an error in the code.

You can also place your cursor into the entry box and it will also show you the return value of the code. Yu can use this to determine if the code it working right:


I think I adapted the code incorrectly.


{{Object.fromEntries(Object.entries([k, v]) => [k, v === "" ? null : v]))}}

1 Like

Awesome! Worked first time :+1:

I was a bit concerned about the lack of greenness but thought it must have been part of the .map cleverness or something.

Thanks a lot I'll need this a bit :sunglasses:


@bradlymathews @dcartlidge

Feels like this should be either a :bug: or feature request? Mis-match between FE component and backend field type (nullable date).

Something under Content on the date component like a Convert empty value to NULL checkbox.

What do you guys think?

Hi @nickaus,

I think you are exactly right that there should be a checkbox allowing us to choose between saving '' and saving NULL.

I suspect it is empty string because the component was designed prior to the release of the retool database. I am happy to be wrong as I haven't tested on different data sources.

Either way, perhaps @Tess will look at this. With the advent of retool_db I think such a feature would bring the date component in line with using NULLs in SQL.

Personally I'd file it under bugs because the advertised behaviour of the component is not the same for the different backends.