Complex Database Query - possible in Bubble?

This is a real head-scratched for me and I’m sure it must be possible in Bubble, but I don’t know how to do it.

I’ve got a database called “counters” with fields called “tool-id”, “user” and “counter”

There’s another database called “tools” with fields called “tool-id” and “time”

I need to run a query that sums the (time * counter) for every entry in the counters database for the user.

Is that achievable?

I don’t think I understood :sweat_smile:

Can you give us a pratical example?

1 Like

Hard to tell based on given information but yes, it is possible.

You need to ensure the time and counter are numbers.

You would have a text element on a page, ‘Do a Search For’ counters, Created by = Current User, each item’s counter:sum + ‘Do a Search For’ tools, Created by = Current User, each items’ time:sum

1 Like

Yes… :+1:

Thanks for the reply - I’m not sure if that process above will solve it unfortunately, as I need to multiply the time (in tools db) by the counter (in counters db), and then sum all of these numbers. Does that help explain it a little more?

At the bottom of the dynamic data picklist there is “Calculate formula”


The bubble manual says

Calculate formula
This source calculates more sophisticated numerical calculations, like loan interests, etc. Reach out to us if you need more options.

Which hides the fact that these features are not well documented :stuck_out_tongue:

Pick “Calculate sumproduct” and it has two list parameters. It gives (list1 item1 * list2 item1) + (list1 item2 * list2 item2) + …