One-to-one

An in-depth look at references from the ground up, starting with one-to-one references

In the GIF below, you can see an example of an app which references items in other parts of the app.

  1. When we look at a staff member, we can see where they work and then tap through to that location without visiting the Locations tab.

  2. When we visit the location, that location references all the staff members that work there and we can tap through again to see each of them. Check out the app here.

We'll walk through how to do this in two stages.

  1. First, we'll do a one-to-one reference. This will create a tappable link on each employee's details page to the location each employee works at.

  2. Second, we'll do a one-to-many reference. This will create tappable references to all the employees that work at a particular location from that location's details page.

Create a one-to-one reference

Create your own sheet with two tabs of data. Or just clone this one for practice.

Before we use our Reference component, we need to make sure our sheet is ready. In our instance, we want each row in the the Staff sheet to link to a row in the Locations sheet.

Step 1: Create a Column for the Reference

Create a new column for your reference and populate each row with the exact name of the row you are referencing in your other sheet.

In this example we want the exact name of the location as defined in the Name column on my Locations sheet.

It's important that the text in your cells are an exact match with the text you are referencing in the other cells.

Step 2: Change the Header of that Column

Now we need to tell Glide that the role of this new column is to reference another column in another sheet. The way we do this is like this:

  1. Leave the original title of the column in place (e.g. Location)

  2. Add an equals sign = after it

  3. Add the name of the sheet where the column you want to reference lives (e.g. Locations)

  4. Add a colon : after it

  5. Add the name of the column which you want to reference (e.g. Name)

Reference header for a one-to-one reference column

​Check out this sheet to see the result. You can copy the sheet and use it as a starting point.

Step 3: Add the reference component to your details page

Add the Reference component. Glide should pick up the reference header and find the column. The bottom three fields of the component will then allow you to choose columns from the other tab that you have referenced.

In this example we are on the Staff tab, but our Reference component allows us to show images and text that are only on our Locations tab.

In the next part, we'll set up a one-to-many reference so our locations can list all the employees that work there.

Here we referenced an item that already visitable from another tab. In other words, we could have gotten to the locations by visiting the locations tab. However, we could get rid of the locations tab in our app entirely and still reference the Offices sheet, i.e. you could go from an employee to their office, without having an Offices tab.

We referenced a row that was in another sheet entirely, to show the power of references. But you can reference another row in the same sheet. You can even reference the same row in the same sheet if you need to.