Backendless Support
 
Answered

Distance-based search on a nested data table

Hey,

I have a Room data table with a one to one relationship with an Address data table. The Address table has 'coordinates' column which is a geopoint relationship.

I'm trying to do a distance-based search on the Room data table with following where clause:

  1. distance(52.00, 19.00, address.coordinates.latitude, address.coordinates.longitude) < km(10)

However I get "Invalid where clause: Possible to use only number value or 'latitude' or 'longitude' in distance function"

How this can be done?

Search on the Address table with

  1. distance(51.00, 19.00, coordinates.latitude, coordinates.longitude) < km(10)

works fine.

Best,

Matt

Leave a Comment

Comments (8)

photo
1

Hello, Matt!

This is a bug on our side, I shall open an internal task for it.

We shall notify you when it's fixed.

best regards,

Alex Navara

photo
1

Thanks Alexandr!

photo
1

Hello,

Any updates? I've the same issue.

Thanks

Michele

photo
1

Hi Michele,

The issue should be fixed in latest version. What version of Backendless do you use - Cloud, Standalone or Pro?

Please also post example of query you execute.

Artur

photo
1

Hello,

Thanks for your reply,

I'm using Backendless Cloud and I tried even from the JS SDK and even from the REST console on your website.

this is the query that I use

  1. distance(38,15, place.position.latitude, place.position.longitude ) < km(100)

Of course position is a GeoPoint in fact the query works well if I call it directly like in this way

  1. distance(38,15, position.latitude, position.longitude ) < km(100)

Thanks

Michele

photo
1

Michele,

What is your application ID?

What is the name of the table where you send the query to?

Regards,

Mark

photo
1

E218CEB2-9F49-DF20-FF02-AC28A72B1200

I'm querying the Events table that has place as property.

If you try the query directly to Places table it works

Regards

Michele

photo
1

Michele,

this is rather odd. I was able to verify that the query is not working in your app. I then ran export/import of the data into a new app, and the same query is working there. I'll assign a developer to look into it. Meanwhile, you could try the same steps to get things going (make sure to link the Places objects to geopoints after the import - it is not done automatically). Also, please do not delete the app where it is broken.

Regards,

Mark

photo