Relation multiple factors

Hi Everyone!

I am trying to show in my app 3 different weekly meal plan: 1 omnivore, 1 vegetarian and one vegan.

In my data base I have:

  • 1 tab Recipes - with the list of all the recipes and 1 column Day to indicate which day it is for.
  • 1 tab My plan - the list of the days and some Multiple relation column to link the recipes to be shown for each day

I would like now, to add a column in my “Recipe” tab to indicate if the recipe is Omnivore, Vege or Vegan, and then add that as a condition in my Multiple relation tab to show “recipes, for the day, that is vegan” for example.

Is his doable?

When it comes to relations, it’s almost always doable :wink:

Real quick, by “day” do you mean a sequential Day number (Like Day 1) or weekday (like every Monday)?

ooooh that’s good news :slight_smile:

Just Day number :slight_smile:

Cool, here’s how:

  1. add a column in the recipes sheet for type (eg Vegan).
  2. In the Glide Data Editor, create a template column that concatenates the Day and Type (eg Day1-Vegan)
  3. In the My Plan Sheet, you’ll need to create an identical template column. I imagine the ‘type’ is a value that lives in the user profile sheet? If so the template column in the My Plan sheet should reference this value so that for each user they get a Day1-(type).

Use this template column as the relation from the My Plan sheet to the recipe Sheet.

2 Likes

Nice one! Let me try this out and tell you how it goes :slight_smile:
thanks a lot for the quick answer @Robert_Petitto

1 Like

@Robert_Petitto just one question, Is your step 2 to be done in the Recipe sheet or My plan sheet?

It needs to be done in both sheets, but specifically I was referencing the recipes sheet in step 2

Does that change something if Recipes can have multiple “types” and multiple “day”?

Each recipe/day/type should be on its own line, then it will work as intended. How is it currently set up?

YEs it is :slight_smile:
But 1 recipe can be shown in multiple days, and multiple types of plan. Because a recipe for a Vegan works just fine also for an omnivore. And in the weekly plan, that recipe can be for lunch both on Monday and Friday for instance

I see. So a vegan should only see vegan but an omnivore can see vegan, vegetarian and omnivore recipes?

Maybe an easier setup then, is to create an array column in the Recipes Google sheet by labeling 3 columns Type 1, Type 2, and Type 3.

For each recipe, populate Type 1 with Omnivore, Type 2 with Vegetarian and Type 3 with Vegan for any tags that apply to the user that can see that recipe.

Eg. Vegan dishes should only have Type 3 populated, vegetarian dishes should have Type 2 and 3 populated and omnivore dishes should have all 3 populated.

This creates an array column in Glide called “Type” with all the values in a singular cell.

Then, no more template column. Just relate the day column in the my plan to the day column in recipes, but on the inline list in the app, filter where the Type array column is the User > Type

2 Likes

Thanks a lot Robert!

the only thing is that when I try to filter the “Inline list” I don’t have the option to put “Type array = User Type”

@Robert_Petitto I found the way to overcome this blocker :slight_smile: I just added a filter with “or” condition for each type column to match the User type column :slight_smile:

@Jeff_Hager has this always been the case with array columns?

Possibly??? I feel like it’s never been possible to look into an array and pick out a value, so instead we would have to make a template or joined list and check with ‘includes’ or ‘included in’. But I’m not 100% sure.

This case might be easier to just create a basic text column that lists all of the Types for each recipe, then check with ‘includes’.

Hm…you could be right…maybe I was thinking of the inapp filter / array column functionality about this very concept:

I was actually looking for the In app filter but can’t find the feature. Is this something only for premium plans?

@Robert_Petitto That could be. I also still have the Multi-Match Filter example in concepts.glideapp.io which fits that theme, but not quite the same case here.

@Deborahlevyben here is the in-app filtering documentation, but I only think this applies to the one of the list style views. I don’t think it’s available for an inline list in a details view.

Thanks a lot guys!! Super helpful as always!

1 Like