In my postgres database, in addition to not null, I enforce columns as not blank with LENGTH(TRIM("column")) > 0
. This eliminates the mess of null or empty string
queries pervasive to web apps. However, when using the form component of retool, it looks like there's no way of specifying null, it always uses empty string for a field that's blank. Am I missing a setting in the documentation that says something like 'send blank fields as null'?
Currently I'm borrowing the same idea of a transformer as setting blanks to nulls in table updates with
const data = {{ Form.data }};
_.forOwn(data, function(v,key) {
if(v !== null && v.trim().length === 0) {
data[key] = null;
}
})
return data;
If I have to create a duplicate a transformer for every form then that's what I have to do. I'm wondering if I missed a setting or another easier way to say 'empty strings in this form are null'