# Get data through 2 layers of relations with a for loop

**URL:** <https://community.glideapps.com/t/get-data-through-2-layers-of-relations-with-a-for-loop/69398>\
**Category:** Ask for Help\
**Created:** [January 9, 2024, 7:18am UTC](https://community.glideapps.com/t/get-data-through-2-layers-of-relations-with-a-for-loop/69398 "2024-01-09T07:18:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raphael\_Bismut](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/raphael_bismut/32/61316_2.png) [@Raphael\_Bismut](https://community.glideapps.com/u/Raphael_Bismut)\
**Post date:** [January 9, 2024, 7:18am UTC](https://community.glideapps.com/t/get-data-through-2-layers-of-relations-with-a-for-loop/69398/1 "2024-01-09T07:18:52Z")

</div>

# Acess data through 2 layers of relations

Hey Glide experts, I have a problem I can’t find a solution for:

My users have selected recipes to cook for their meals for the next week  
Each recipe has a certain number of ingredients  
I want them to click on a button and that will generate a shopping list with all ingredients to buy in the right quantities

My tables are:

- Users
- Recipes (has all recipes)
- Ingredients (has all ingredients)
- Meals (has a day and a user)
- Ingredient in recipe (a row links an ingredient to a recipe with a quantity)
- Recipe in meal (a row links a recipe to a user’s meal)

My problem is that I need a list of recipes in all meals, and then get all ingredients from all these recipes, with their quantities

I thought a good way to do this was to add a row to a table for every ingredient in a user’s shopping list but Glide doesn’t do that

Does anyone have an idea?  
Thanks 🙂
