Hi there,
I am totally new to Bubble, hence would really appreciate your help here!
What I want to achieve: I am trying to generate a shopping list of ingredients based on a number of selected recipes. The shopping list should be aggregated across same types of ingredients (i.e. 2 apples + 1 apple = 3 apples, etc.) as well as sorted according to categories (i.e. apples under the header ‘fruit’, carrots under the header ‘veggies’, etc.)
I have achieved these first two step by using repeating groups with different grouping and aggregation options.
The complication is, that for each recipe, a user might want to select a different multiplier (i.e. recipe A contains 1 apple, recipe contains 2 apples - however recipe A should be cooked for 2 servings and recipe B for 3 servings and hence the total amount of apples should be 12 + 23 = 8).
In the current set up, I cannot link the multiplier per selected recipe to the quantity of each ingredient without losing aggregation across different recipes, i.e. as soon as I add Selected Recipe as part of the Grouping, ingredients belonging to different recipes show up as individual line items.
My relevant data-structure looks as follows:
- Recipe (includes overarching recipe info, e.g. name, prep time, etc.)
- Selected recipe per user (includes multiplier per recipe and uniqueID of the original recipe)
- RecipeIngredient (describes the individual ingredient (e.g. quantity, name, etc) per recipe, linked to mother recipe via uniqueID)
Current assumption for a solution: Do I need to generate a new data type (Shoppinglist_Item) which includes as ‘new_quantity’ = ‘multiplier’ * ‘original quantity’ and run the grouping and aggregating on that? However to do so, I have to generate many new shoppinglist items when selecting a new recipe by running ’ Schedule a Workflow on a List’.
My question: Is there a better way to do this by setting up my data structure differently, or do I need to indeed figure out how the ‘Workflow on a list’ works?