Complex calculations or list by list mulitiplications?

Hello.

I am working on a foodplanner app and I have encountered an issue that I cant seem to find a way to solve.

The issue cant be solved because bubble is not capable of performing these common functions:

  • Create several items in a table at once (you can only creat 1 item at a time)
  • Not possible to iterate/loop over each row of a RG (there are plugins such as list shifter karma-ware but the documentation is almost nonexisting or the API workflow which requires subscription)
  • Complex aggregations with several tables

However I hope that there is a simple solution and that I have attacked the issue from an incorrect angle. Therefore I hope someone can point me in the right direction.

Right now I have 4 tables

  • Foodplanning table (a row for each date. A row can point to several rows in the foodplan portions table)
  • Foodplan portions (each row specify the number of portions and a reference to 1 recipe in the recipe table)
  • Recipe table (each recipe contains the name of the recipe, total nutrient information and references to several rows in the recipe foods table)
  • Recipe foods (each row is a food with an amount in gram)

Foodplan
Foodplan Portions
Recipes
Foods

I want to create a shopping list list either as a repeating group or in a backend table. If we take the 4 tables above as an example.

I choose to create a shopping list with foods for 16-apr and 17-apr (look at the food planning table). In the end the shopping list will look like this:
Shopping List

As you can see the portions have been multiplied with the grams in the food table for each day and then summed up.

However this has turned out to be quite a challenge in bubble. If I try to perform a calculation by using all 4 tables I am limited by:

  • only able to sum all grams and then mulitply with portions - which will result in incorrect number
  • when using sumproduct I am only able to multiply the portion with the first food’s gram

On the other hand, if I wish to save all the foods in a recipe into a seperate table when allocating a recipe in the foodplan then I am limited by the inability to creat several rows in a table.

Therefore how do I solve this issue? thanks for your time.

Hello @t.leicht84

Did you manage to solve this problem?