Retrieving the elements in a child of relation property in the child class

Hello, so suppose the Users table has a 1:N relation with an Events table named “events”, which stores the events that a User is going to.

Now, what I want to do is be able to pull All current events from the Events table, which is possible, but I also want to find a way to pull the contents of, or in a perfect world, the number of elements in the child of relation in the event. The goal is to make it so I can sort the events based on number of people going, without having to also query the Users table for the events, which I am currently doing and is very slow.

Any ideas?

Hi Michael,

It is much easier with the version 4 of Backendless which includes API to retrieve object count (including support for related object count):
https://backendless.com/docs/android/doc.html#data_get_object_count

With version 3, you’d need to set pageSize to 1 and run a query against the Events table loading only 1 object. The result will also contain the totalObjects property which is the number of objects matching the query.

A basic query to get related Events would look like this:

Users[events].objectId = ‘objectId-of-user-owner-of-events’

Regards,
Mark

Alright, I’m waiting on another ticket to finish before I attempt to update to version 4, so When I do that I’ll try it there

Just to confirm, the SDK for IOs, and the cloud version of the console for Backendless 4.0 have yet to be released, correct?

Yes, that is correct - they are yet to be released.

Any rough ETA on that? Don’t want to make a lot of changes if I’m gonna have to re-write stuff soon

Should be available by April or early in April.