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!
Hi, on your option panel on the right side of you Glide editor, you can select the filters and replace ID by Names
Hello and welcome to the community
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?
2 columns total… a relation and a lookup
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.
Ok. So I have these two columns now in Items:
The ID is being added automatically via record create. And then _name is using a RELATION to grab the name. This seems a bit clunky but it works.
However…when I go to create a filter, category_name is not an available option. I am guessing because it is a "computed’ column type.
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.
I don’t know why I can’t wrap my head around this
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 …
In your configuration change the “Relation column:” to the new relation we created then select the name column.
I wiped category and am trying again.
To create the first CategoryID relation column, these are the options I am given. What do I select here?
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.
That was so helpful. MUCH appreciated!