API Connector getting sum of parameters of large data group

Hi there,

Question: I have two Bubble apps (app 1 with a database, app 2 with a frontend). I use the Bubble API Connetor on app 2 to display data from app 1. The data I want to display are events of app 1 with a name field and an “amount” field. So, for example I have the event “LinkClicked” with the “amount of 10”. So far that is only one entry in the database, but with its amount parameter it shows me that a certain link was clicked 10 times.

How can I display the total amount of actual events which happened? For example if I use “response count” or “response remaining” I get the number of entries of that data type (e.g. LinkClicked has 1 entry) but I need to total sum (e.g. 10 because there is one entry of LinkClicked with an amount of 10. Or later, there are 5 entries of that event, each with an “amount” of 10, so in total 50 links are clicked).

Does anyone know how to achieve it?


You can simply use the :sum operator on the App 2 frontend after the App connector has returned the list of entries from App 1.

Alternatively you could set up a backend API workflow on App 1 which processes the entries and returns the processed value (in your case the sum of the fields).

Hi Nico!

Ok, thank you! Where do I find the :sum operator? When i use the API connector on app 2 I’ll get a “response” item first with a couple of options like: response, response cursor, response remaining, … (see in the screenshot attached). Also, I think the API connector would only get the first 100 results in the first place, would :sum still consider all results above the initial 100?

And will check your second idea too.

No it would not.
The :sum operator is being applied on the user’s computer on the data that app 1 returned. It definitely would not be able to apply to data that never left app 1’s database.

For the sake of completeness, to access the :sum operator you would have to select response (to access the actual data response) and then select :each item's field, and :sum would then be available (if the field is recognised as a number).

As you said, the API workflow will only return the first 100 elements. To get the total Sum of more than 100 elements, you will have to create a backend API workflow in App 1. This will simply contain a ‘Return Data from API’ workflow step which runs a search for Events with the constraints of your choice + ‘:each item’s field: sum;’. You would then be able to call this API from App 2, which will only receive a number representing the total sum.

Ok, thank you a lot! Will have a look into the workflow solution.