Rollup of secondary items in recipe calculator

Here’s a thing that has been a head scratcher for some reason during the weekend. I’m building a everyday management app for a small restaurant. In this there is a recipe calculator. It calculates production need based on input number.

The calculator page consist of a choice component and a number input, these values are connected to user table.

The structure of tables are pretty simple:

Meals | Recipies

Recipies | Ingredients

Ingredients

Recipies consist of ingredients. Meal consist of one or more recipies. The results are displayed in a table on the recipe calc page based on selection. Getting it to show summary of recipies + qty needed is not a problem. But on same page I’d also like to show a breakdown of ingredients + qty needed, and for the life of me, I can’t get this to work properly. As one ingredient can be included in several recipies I will also set it up to roll up the total and display only one row per ingredient.

I’m scratching my head thinking I might need to re-do the flow and include a helper table to which an action writes ingredient Id:s and meal id:s and use this as source for the ingredient summary table but not quite sure this is the right way.

Solution might be easier than I think I suspect. I kinda got stuck in this one.

Any advice would be much appreciated. :flushed: :thinking:

A. Things that has B. Things that has C. Things. Display rollup need of qty of C. Things based on number input of qty of A. Things needed to be produced.

1 Like

I understand the issue. Two possible ways to solve.

  1. Interactive: Use a custom collection for the meals and then a collection within the custom collection for ingredients
  2. Not as interactive: Create an HTML table. Use template columns to generate HTML structure at the ingredient level. Join these at the Recipe level and view then as Rich text within a custom component at the meal level
3 Likes

Thank you Robert. I went with option nr 1. Worked perfectly!

1 Like