How to filter on NULL vs EmptyString

Hello all,

I’m stumped with what I thought should have been a simple setup.

I have some JSON that’s sent to a webhook, which is then used to update a record.

For those that are familiar with the Make data stores, the only way to clear a field value, is to use the Add/Replace a Record module, whereby you just fill out the fields that still exist and leave the one that is empty, to basically replicate the “clearing” out of that field.

Now let’s say my data consists of 4 columns.

Let’s say I create the record the first time, with all this data.

Let’s say I want to slightly update the record, I want to only clear the value in column 1, but leave the other values untouched. Now in other systems, normally to clear out a value, you can send a JSON response, eg.

{
“id”:1
“col1”:null
}

However in Make, it gets outputted like this

So no matter what filter I try, i.e if col1 is null or does not exist, or is equal to {{emptystring}}, it still goes through on all of them.

I want the clearing of the value to only happen if the user has included the field key in the request, but with a null or emptystring value. The clearing of the value should not happen if they do not send the field key across.

Anyone have any ideas of how to setup the filter for this?

Hi @D-EFFCON ,

What about you set your own null variable string say “N/A” and then in the filter or in the next module you just say if the value is “N/A”, then consider it as an emptystring? Sometimes empty values don’t even get considered as any value or null or anything and just get ignored, I don’t know much about json to answer that.

Hope it helps,
kud

Hi

I am not sure to understand your original problem, if you use the update Record Datastore module, with {{emptystring}}, it only deleted the field you want to clear out. I am not sure using a router with the 2 modules makes sense.

Hmm, you are right

I have done this a few times before with the Update a record module, but it didn’t use to work (I think I last tested it out again about 3 weeks ago), but it seems to work now (as it should have done in the first place) so that’s good.

That said my issue is that, I only want the record to be cleared if the JSON response includes the field key (but with an empty value)

I.e

{
    "id": 1,
    "col1": null,
    "col2": "b",
    "col3": "c"
}

Should clear out the value in col1 in my data store.

But if someone sends a response like this

{
    "id": 1,
    "col2": "b",
    "col3": "c"
}

I don’t want column 1 value to be cleared out. The other values should be updated though. Does that make sense?

Looks like I managed to figure out a solution

When someone sends a JSON, instead of getting them to send a null value, I would get them to send the key value but with an {{emptystring}}

See examples below

You will see that even if you set the filters to work based on the JSON you sent

It still activates on the other routes, even though they aren’t technically empty strings.

The solution I have found to work, is you can use the contains() formula to check if there is indeed an {{emptystring}}

w

Now when you run the scenario based on these filters, it only triggers when the key is present and the value is {{emptystring}}

3 Likes