Support Topics Documentation Slack YouTube Blog

Dropsource-API-Backendless: Count items

Hi there!
I’m trying to build an app with Dropsource and Backendless.
I’ve already created the data tables and the API Specs, imported in Dropsource and got some data.
Now I need to calculate how many items are in a related cell for every row.

The data will populate a text filed in every cell of the collection view. For example like a notifications counter, every object has a cel with messages, and I have to get the number of the total messages for each object.

I can’t explain it better :wink:
Thanks for your help!

Hi Mario,
if I understand you correctly, the question is how to find out the number of related objects for each of the records in the table. For this you can use the Objects Count API.
Let’s say there is a table Message and table Comment.
Each Message object has a 1:N relation to Comment in comments column.
And you need to know how much comments has each Message object.

For each Message object you can make a call:
https://api.backendless.com/:appId/:apiKey/data/Comment/count?where=Message[comments].objectId = 'YOUR_MESSAGE_OBJECT_ID'

And you’ll get the number of comments for specified Message object.

Regards,
Stanislaw

Thanks @stanislaw.grin! It works. I’m happy to see that backendless and Dropsource are working very well together.

Happy coding and feel free to ask if there are any other questions!

Stanislaw