search table by Property where Null

Is it possible to search a table for a certain property whose value is null?

Obviously https://api.backendless.com/v1/data/Request?where=requestId%3Dnull does not work.

Thanks.

try this where clause:

requestId IS null

Regards,
Mark

1 Like

The question is how would I include that parameter in a URL.

https://api.backendless.com/v1/data/Request?where=requestIdISnull ?

That doesn’t look right. Didn’t work.

it must be URL encoded. Try this tool for example:

http://meyerweb.com/eric/tools/dencoder/

You will get the following result:
requestId%20IS%20null

Really thought that one would work. The result was

{"offset":0,"data":[],"nextPage":null,"totalobjects":0}

Do you have any objects where requestId is null ?

Yes, I changed one of the requestId to null and made sure it saved.

Try testing it in console. Make sure “SQL Search” is ON:

https://backendless.com/feature-14-sql-based-search-for-data-objects-using-console/

I turned on SQL Search and still no luck.

https://api.backendless.com/v1/data/Request?where=requestId%20IS%20null” returns {“offset”:0,“data”:[],“nextPage”:null,“totalObjects”:0} while

https://api.backendless.com/v1/data/Request?where=requestId%20%3D%20null” returns {“code”:1017,“message”:“Invalid where clause”}

As a workaround, I am changing the default values to 1 so that they are searchable.

Could you please attach 2 screenshots of Backendless console:

  1. With all the data in the table showing table columns
  2. When you run the query

Regards,
Mark

Data + query in console attached.

You’re using REST Console, not the SQL search. The SQL search is this:

Also, I think the data which you believe is null, might be an empty string:

I think you’re right about the data being an empty string rather than null.

requestId = ‘’ returns the correct data.

Did I change that field from null to an empty string, or is it created as an empty string?

I see now. It looks like the data is created as an empty string, unless I specify “(null”) in Default Value. In that case, searching requestId%20IS%20null seems to work :slight_smile: Thanks.

If the value is missing we use null as the default. You must’ve changed it to an empty string.

I must have. Ok thanks for the clarification. I’ll change the default value back.