How to Sum "Columns" in a repeating group using another repeating group?

I’m trying to use a repeating group to calculate the sum of a list of things (number inputs) in another repeating group by the order of each thing.

It’s easier to explain by video: https://share.getcloudapp.com/geuW75Oy

Editor: https://bubble.io/page?type=page&name=periods&id=malt-test2&tab=tabs-1

Ideas?

1 Like

I recently just went through this - Incredibly painful… I hate how limited RGs are. Especially in your case, trying to use 1 RG to access data in another RG… lol accessing data in 1 RG is hard enough!!

Best recommendation is to get @gaurav 's RepeatingGroupTools (bdk) plugin. It allowed me to take data from one repeating group on my page and sum it in each row of another repeating group.

Here’s a screenshot of my app: When you change the “CASH Account” dropdown at the bottom, it updates the sum in the repeating group at the top (CASH Needs Thru). Disregard the fact that CASH Needs doesn’t add up - I have other numbers being added into that.

Is this helpful? Or did I completely misunderstand what you’re trying to do here haha…

Thanks @w.fly. I’ve used RGTools plugin before. May have to do that again.

Appreciate your help. It seems as if we are working on similar things (i.e. using Bubble for financial applications).

OK, I’ve figured it out without needing a plugin. The key is to create a sequential number field in the datatype. By having a sequence (i.e. 1 thru 12 for 12 monthly periods) you can use the Constraint in the Do a Search For… function to match the thing’s sequence number (in my case the Account Period’s period#) to the Current cell’s index.

And if you need it to have flexibility to go above the 1 thru X predetermined range (mine is 1 thru 12), you can modify the Current cell’s index number by simple addition of an offset number.

So, in my case, I use the extract function to determine the number of months different from the starting date. So if I want to show months 13 - 24, I change the dropdown year to 2021, from 2020, so the visible range is now Jan - Dec 2021 (i.e. months 13 - 24). The extracted offset number is 12, so the Current cell’s index number + offset# (12), yields a numeric range of 13-24, exactly matching the periods I want to match.

2 Likes

You can also create two different types of data sources, and use the “do a search for” and then “calculate sum product a*b” function which works awesome. You can do some pretty advanced calculations if you know how to structure your database with it, thats the key.