What Is a Conditional Relation?
A conditional relation connects two tables, like any relation, but only under specific circumstances—e.g., “only connect reviews that belong to the signed-in user.” Glide doesn’t offer a native “conditional relation” toggle. Instead, you create a computed column that applies your condition first, and then build the relation off that.
Example: One Review per User per Lesson
Let’s say you’re building a learning app with:
A Lessons table
A Reviews table
A Users table
You want each user to be able to leave one review per lesson and also be able to edit or delete that review.
Step-by-Step: Creating a Conditional Relation
1. Set up the schema
Lessons have a
Row ID
Reviews include
Lesson ID
,User ID
,Review
,Timestamp
,Rating
2. Capture the right values in the form
When a user leaves a review, prefill:
Lesson ID
from the screenUser ID
from the signed-in user's profileTimestamp
as current date/time
These can be passed as hidden values in the form.
3. Create an If–Then–Else column in Reviews
This column will return the Lesson ID
only if the review belongs to the signed-in user.
Example logic:
If User ID
is signed-in user's ID → then Lesson ID
Else → blank
Call this column something like: Current User’s Lesson ID
4. Create the conditional relation in Lessons
In the Lessons table, create a single relation:
Match
Lessons → Row ID
toReviews → Current User’s Lesson ID
This links each lesson to the current user’s review, if one exists.
Using Conditional Relations in Your App
💡 Prevent Duplicate Reviews
Show the “Leave a Review” button only if the relation is empty.
💡 Edit an Existing Review
Show an “Edit Your Review” button only if the relation is not empty, and use it to open an Edit Screen through the relation.
💡 Show a List of All Reviews
Create a multiple relation from Lessons → Reviews based on Lesson ID
, then show it using an Inline List.
Bonus: Improve UX with Related Enhancements
Use a relative time column for prettier timestamps ("10 minutes ago")
Style the reviews list using cards and set action to none
Use a template column to show rating like
4 out of 5
Summary
Conditional relations let you:
Show personalized data
Prevent duplicate actions
Navigate cleanly between related records
Even though Glide doesn’t offer a UI for complex conditions within relations, building them with computed columns gives you the same power.