Consolidating values in an inline list

I’m creating a meal planning app that contains a shopping list for users, based on meals that have been assigned to them. The way I’ve set it up is by creating a Meal Plan screen which contains an inline list of recipes and a list relation of ingredients (related to the selected recipes).

Within the details screen of the list relation, I’d like to consolidate ingredients and quantities instead of having them appear multiple times (because they’re in multiple rows).

For example if two recipes within the meal plan each contain 2 slices of wholemeal bread, how do I consolidate it to show 4 slices of wholemeal bread instead?

Example below:

Also - is there a way to remove the > arrow at the end of each item in the detail screen of the inline list? I’ve disabled the action for a Detail screen to open but the arrow still stays there.

I don’t know exactly how you structure the data, so I’m assuming it looks something like this:

Meal Plan ID Type Name Quantity
MP001 Bakery Wholemeal Bread 2
MP001 Bakery Wholemeal Bread 2
MP001 Bakery Multigrain Bagel 1

Then, what I would do is:

  • Add a rowID column so it becomes something like this:
rowID Meal Plan ID Food Type Food Name Quantity
abc MP001 Bakery Wholemeal Bread 2
def MP001 Bakery Wholemeal Bread 2
ghi MP001 Bakery Multigrain Bagel 1
  • Create a template column joining the meal plan ID, food type & food name, let’s call it food_temp:
rowID Meal Plan ID Food Type Food Name Quantity Food_Temp
abc MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread
def MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread
ghi MP001 Bakery Multigrain Bagel 1 MP001-Bakery-Multigrain Bagel
  • Create a multiple relation from the food_temp column to itself.

  • Add a “first ID” column to return the first rowID from the relation.

rowID Meal Plan ID Food Type Food Name Quantity Food_Temp firstID
abc MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread abc
def MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread abc
ghi MP001 Bakery Multigrain Bagel 1 MP001-Bakery-Multigrain Bagel ghi
  • Add a rollup column to sum the quantities on top of each relation.
rowID Meal Plan ID Food Type Food Name Quantity Food_Temp firstID Sum
abc MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread abc 4
def MP001 Bakery Wholemeal Bread 2 MP001-Bakery-Wholemeal Bread abc 4
ghi MP001 Bakery Multigrain Bagel 1 MP001-Bakery-Multigrain Bagel ghi 1

Then in your inline list, filter what to show by: firstID is rowID

Show the “sum” amount alongside the unit. You might want to consider singular and plural units for each type of food.

2 Likes

Hi ThinhDinh, thanks so much for your help! I’ve gone into Glide to try and follow your instructions but I can’t get this approach to work because I’ve set the data up a little differently.

Instead of each row containing a single meal plan, I have a multiple relation column to the meal plans and then a lookup for meal plan IDs - so there are multiple meal plan IDs that the Ingredient connects to.

Any advice on how to approach with this data structure?

Thanks in advance!

Can you give me a screenshot of how you’re setting it up

Hi ThinhDinh, I’ve come back to look at this and I have set the data up per the instructions above. You mention Add a “first ID” column to return the first rowID from the relation. Can you please tell me how to do this? Everything else I believe I have in hand. Thank you again!

That would be a Single Value column.
Point it at the relation and select the first RowID.

1 Like

Thanks so much Darren_Murphy and ThinhDinh! I’ve been able to achieve what I was looking for thanks to your help :slightly_smiling_face:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.