How do I model circular/many-to-many relationships in Coda?

Hello all,

new Coda user here! Suppose I have this relationship

**Recipes database:**
Recipe 1 (tomato omelette) -> eggs, tomatoes
Recipe 2 (spinach omelette) -> eggs, spinach

**Ingredients database:**
Eggs -> Recipe 1, Recipe 2
Tomatoes -> Recipe 1
Spinach -> Recipe 2

How do I model that in Coda? (The tricky part being ‘Eggs → Recipe 1, Recipe 2’).

Many thanks!
Björn

You have to pick a primary relationship direction. Base your decision on which way you’ll most frequently create/edit the relationships. E.g. if you want to make recipes and then add eggs to them, have a Lookup column in the recipes table.

In the ingredients table, make a lookup column. When choosing lookup column, there’s an option for “Referenced By” - choose this to see all recipes that reference this ingredient.

2 Likes

Hi @Nick_HE,

Thank you - the trick was to ‘allow multiple selection’ in the configuration of the lookup!

Thanks!
Björn

2 Likes

I’d suggest using an approach to many-to-many relationships that comes from the relational database design world. Many-to-many relationships involve three tables. In your example, they would be: Recipe, Ingredient, and an “association” table. This association table features lookups to the Recipe and Ingredient tables. To help make it clearer, I created a barebones example of the three tables on this doc: Many-to-Many. You can create views, filters, and sorts on the association table that satisfy your information needs.

2 Likes

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