"ISNULL" equivalent available?

Hello all,

I’m just wondering if there is something equivalent like “ISNULL” (SQL Server)?

Background:
I’m ordering my list of entries via “-sys.createdAt”.
In our requirement it should be possible to set a “created at” date explicitly if necessary (to have the possiblity to set a entry back in time).
For this we have created a custom “created at” date field.

Now it would be great if I could order by my custom “created at” field and if it’s null “sys.createdAt” should jump in, e.g. like ISNULL(fields_created_at, sys_created_at)

Is something like this possible? Or are there any recommendations to handle this problem?

Thank you very much!

Hi @chavaroche,

If I understood you correctly, you’d like to do two actions with a given field A of your content type:

  1. Find entries that do not have a value on field A
  2. Populate field A of these entries with a given default value

Is that a correct assessment?
If so, the simple way to do that would be to use the existence parameter to find entries that do not have a particular field value (e.g. fields.fieldA[exists]=false) and subsequently send a simple PUT request to update it with a given value. You could easily programmatically do that by using one of our SDKs.

Let me know if that makes sense :slight_smile:

Hi @gabriel,

is there any way to filter for a field with a specific value or null? I mean, something like:
fields.fieldA[exists]=false OR fields.fieldA=someValue

Would it be valid this?
fields.fieldA[in]="",“someValue”

Thank you.
Regards

Unfortunately your last query wouldn’t work out (fields.fieldA[in]="",“someValue”). We don’t have a parameter that fully mimics the behaviour of a given OR operator.

In this case, you’d need to perform two separate requests and concatenate results in your final response.

Hope this helps!