I am new to Glide but old to programming. This software is so slick but I can’t for the life of me figure out how to do a simple select list from another table.
I have “Items”. One of the fields is “Category”, so I made a Categories table. Categories only has “id” and “name”.
In “Items”, I have “Category”, which I have set to accept “category_id”, which is easy to set when creating a new Picker with the display as Name and value as ID.
But… when I go to acess Category for a specific Item, it only displays the ID, rather than allowing it to grab the related Name. So, for instance, my filter looks like this:
I figured maybe there is a “Computed” type for category_id, but those just seem to grab the raw data, rather than creating a related table.
Tried all I can think of…and I am now stuck. Any advice is helpful!
In case the Name is not in that table what you could do is create a SINGLE Relation from the ID in your Items table to the ID in your Categories table and then use a Lookup Column via that Relation to return the Name. Finally use that Lookup Column as the source of your filter.
@lucas: thank you. The problem is… the data in the column is the category_id. And there doesn’t seem to be a way to show a different value via lookup?
@eric: thanks. So you’re saying in my Items table, I would have two columns: “category_name” (single relation to grab the name) AND "category_id"which holds the relation id?
Create a Single relation between this ID column in the items table and the ID column in your categories table.
Next add a lookup column, use the relation above and return the Name column.
This should put the name of your categories on each row of your Items table. Finally in the right hand side of the layout editor change your filter to use that new lookup column.
Where is your lookup column? We need to configure a lookup column via that relation and return the name.
FYI the relation is not returning the name… it’s simply showing you that there is a match. In this instance the relation so happens to be displaying the Name column by chance.
Items
id
name
category_id → RELATION to “id” in “categories” table
category_name → LOOKUP to category_id? I do not see anywhere in the LOOKUP settings to tell it to return name …
Your relation was fine as it was. You need to correct your Lookup column to use the relation. You have it configured to use the entire table instead of the relation.
A Relation establishes the link to rows in the related table. The Lookup retrieves specific column values from that relation.