How to Cross-Check User Allergies with Menu Items in Glide?
Hi Glide community,
I’m building an allergy-safe restaurant ordering app using Glide (Classic App), and I need help with cross-referencing two sets of Boolean values.
The setup:
User Sheet: Each user has a row with Boolean columns (e.g. hasEggAllergy, hasPeanutAllergy, etc.). Checked = they have that allergy.
Menu Sheet (Store-side): Each food item also has Boolean columns (e.g. containsEgg, containsPeanut, etc.). Checked = the item contains that allergen.
What I want:
When a user views a menu item, I want the app to check if any of the allergens they have (user’s Booleans) match the ones in the food item (menu’s Booleans). If there’s a match, I want to:
Display a warning (e.g. “ Contains ingredients you’re allergic to”)
Optionally, color code or hide unsafe items
The issue:
Since user data and menu data are in different sheets, I’m not sure how to compare Booleans between the current user and the current menu item dynamically in a single view. Glide doesn’t seem to support multi-column cross-referencing directly.
Has anyone done something similar?
What’s the best way to implement this “Boolean-to-Boolean cross-check” logic between two sheets in Glide?
I’ve added screenshots of what I have right now too.
It would be great if you could give me feedback.
Thanks so much in advance!
Image 1: Sheet of Users. The Booleans on the right of the sheet are the allergies.
Image 2: Sheet for restaurants. Each row is an individual menu, and the Booleans on the right are the allergies. Further right is some Booleans which says (Allergen Name show). Here I tried to use “Show Component” to check with these (Allergen Name, show) booleans, but that didn’t quite work.
Whilst it might be possible to get this to work using your boolean approach, it could get quite messy.
I would suggest an alternative approach. Instead of using a series of boolean columns, just use a single column in each table.
In your users table, have a column with a list of allergies, eg: eggs, peanuts, milk
In your Menu table, have a similar column that contains a list of allergens that item contains, eg. eggs, peanuts
Then add the following columns in your Menu table:
– A split text column that creates an array from the allergens column
– A template column. Fill this with the list of allergies from the User Profile row
– A split text column that creates an array from the previous column
– A relation column that matches the two array (split text) columns
If the relation is not empty, then display your warning.
As well as being simpler, the advantage of this approach is that it will scale. That is, you won’t have to keep adding columns and updating your logic as new allergens are added.
Mr Murphy,
Thank you for helping, and sorry for the late reply.
I forgot to mention that the app requires the user to register their allergies through a button system (see below)
In the backend, these buttons sets the “Allergies” in the Users table when it doesn’t contain that specific allergy.
The “add allergy” button then hides itself, and a “remove allergy” button shows. When pressed (or when the Users table contains that specific allergy), it deletes that allergy from the sheet.
Unfortunately, I can’t figure out a way to do that with the Text Column.