# Relations Question

**URL:** https://community.glideapps.com/t/relations-question/10074
**Category:** Ask for Help
**Created:** [May 31, 2020, 6:04am UTC](https://community.glideapps.com/t/relations-question/10074 "2020-05-31T06:04:02Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 6:04am UTC](https://community.glideapps.com/t/relations-question/10074/1 "2020-05-31T06:04:02Z")

</div>

I have 3 sheets.

1. Trips
2. Categories
3. Reservations

I’m trying to link everything like the following:  
Open Trip 1 \> View All Categories (i.e. Flights, Agenda) \> View only the related items for this specific trip

It’s easy for me to link Trips & Reservations, but can anyone help me get the “Categories” in there first, and then show the reservation details?

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 31, 2020, 6:07am UTC](https://community.glideapps.com/t/relations-question/10074/2 "2020-05-31T06:07:08Z")

</div>

> [@Relating a Category to a List of Episodes to a List of Videos with Details](https://community.glideapps.com/t/relating-a-category-to-a-list-of-episodes-to-a-list-of-videos-with-details/10011/8):
>
> Take a look at Multi-Level Select in [https://concepts.glideapp.io/](https://concepts.glideapp.io/). The key is to build templates for your relations if you need to go multiple levels deep.

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 6:27am UTC](https://community.glideapps.com/t/relations-question/10074/3 "2020-05-31T06:27:18Z")

</div>

I’m digging in some more but not following one piece.

In my example, I’d like for the middle page (i.e. categories) to be static and not change. So every trip has a flight, every trip has a schedule, etc. I’m having trouble linking the Trip to the Category, and then the Category to the relevant details.

Does this showcase app help?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [May 31, 2020, 8:05am UTC](https://community.glideapps.com/t/relations-question/10074/4 "2020-05-31T08:05:34Z")

</div>

Does this comment help?

> [@Relating a Category to a List of Episodes to a List of Videos with Details](https://community.glideapps.com/t/relating-a-category-to-a-list-of-episodes-to-a-list-of-videos-with-details/10011/13):
>
> Check out how I make three sheets here: Level 1: Category Level 2: Episodes Level 3: Videos In Level 1, I make a relation to the Episodes sheet. [image] In Level 2, I make a template joining the Category and the Episodes value, then use that column to make a relation to the Videos sheet. Make sure you also create a same template column in Level 3 to make the relation work. [image] [image]

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 4:16pm UTC](https://community.glideapps.com/t/relations-question/10074/5 "2020-05-31T16:16:30Z")

</div>

Thanks for this, though I admit I’m still confused!

On sheet 1, I have all of the Trips (i.e. NYC, Miami, etc.). On sheet 3, I have all of the info correlating to each trip. On sheet 2 I want to have a static image of a plane. So:

When one opens NYC, they see the flight icon, open it and view the flight.  
When one opens Miami, they see the flight icon, but when they open it they view the Miami flights only. Is this doable? I’m running into issues with both concept apps here.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 31, 2020, 4:22pm UTC](https://community.glideapps.com/t/relations-question/10074/6 "2020-05-31T16:22:13Z")

</div>

Can a category have multiple pieces of information? For example, if you had multiple flights for one trip? Would you only want to only see one flight icon to click through and see all flights, or would you want to see multiple flight icons, but with the same image?

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 4:27pm UTC](https://community.glideapps.com/t/relations-question/10074/7 "2020-05-31T16:27:50Z")

</div>

Great question, thanks for clarifying.

The “flight” category can have multiple flights, but only want to view the ones directly related to that trip. The issue I’m having is getting the categories to match the trip ID on one end, and then match the flight AND trip on the other end.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [May 31, 2020, 4:30pm UTC](https://community.glideapps.com/t/relations-question/10074/8 "2020-05-31T16:30:42Z")

</div>

What I would do is create another sheet that replaces your category sheet and uses the unique formula to build a list of unique trips/categories. Then create a relation to link the trip sheet to the trip/categories sheet and display this as an inline list. Then you can click through from the trip to the trip/categories details. Within the glide data editor, you can then create an if/then column to refer to an associated image url or use a relation to another sheet that contains your images and categories followed by a lookup to pull in the image url. Also create a template of the trip/category in the trip/category sheet and do the same in the reservations sheet. Then you can create a relation to link the two templates and you can then have an inline list of the associated reservations within the details of the trip/category sheet.

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 5:02pm UTC](https://community.glideapps.com/t/relations-question/10074/9 "2020-05-31T17:02:55Z")

</div>

Thank you! Let me play around with this idea, and report back!

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [May 31, 2020, 11:54pm UTC](https://community.glideapps.com/t/relations-question/10074/10 "2020-05-31T23:54:17Z")

</div>

Circling back, how does the UNIQUE formula help? I’m hitting the same issue again:

When I open a trip to view the flights, I view flights for EVERY trip, and not that specific one.

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [June 1, 2020, 12:06am UTC](https://community.glideapps.com/t/relations-question/10074/11 "2020-06-01T00:06:58Z")

</div>

The UNIQUE formula takes all unique values inside the defined range. Can you show me how you setup your data now?

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [June 1, 2020, 12:10am UTC](https://community.glideapps.com/t/relations-question/10074/12 "2020-06-01T00:10:59Z")

</div>

Here’s a sheet with the bare bones.

> **[Res +Trips](https://docs.google.com/spreadsheets/d/1Nxz2iHHdwfg07GlAXL_JY94cTlBXX53-Zj2sfQAKmiY/edit?usp=sharing)**
>
> Trips
> 
> Trip Name,ID,IDMerge
> NYC,1000,NYC1000
> Miami,1001,Miami1001
> Peru,1002,Peru1002

I want to link the NYC1000 to Flights to then view both corresponding flights

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [June 1, 2020, 12:12am UTC](https://community.glideapps.com/t/relations-question/10074/13 "2020-06-01T00:12:07Z")

</div>

I’m able to link the Trips to the Reservations, that’s easy with a Relation. However, I can’t figure out how to get every Trip it’s own set of Categories, which then link to the relevant reservation. Does that make sense?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [June 1, 2020, 1:07am UTC](https://community.glideapps.com/t/relations-question/10074/14 "2020-06-01T01:07:32Z")

</div>

So let me go through this again to see if it helps.

You have a bottom level sheet, which contains all the reservations. Let’s say it contains columns of trips, categories and reservations.

We go backwards to the 2nd level, which is the “categories”. For this one I want a unique for all trips & categories, the 2 top levels. I use a formula like this to take into account the empty rows as well.

```
=UNIQUE(FILTER(Res!A:B,Res!A:A<>""))

```

Then, in the top level, I follow the same logic and get uniques for all the trips. That would be:

```
=UNIQUE(FILTER(Res!A:A,Res!A:A<>""))

```

Then you can build all the relations as I have mentioned in the linked post. Tell me if I can help.

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [June 1, 2020, 2:19am UTC](https://community.glideapps.com/t/relations-question/10074/15 "2020-06-01T02:19:26Z")

</div>

Following a bit more now. What’s this for (on the Reservations tab by each item), and how do I move forward with it? Do I add to it?

Reservation  
A001  
A002  
M001  
P001  
A001

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [June 1, 2020, 2:42am UTC](https://community.glideapps.com/t/relations-question/10074/16 "2020-06-01T02:42:59Z")

</div>

Yeah that’s just my example data, fill in what you want within that column.

---

<div class="post-metadata">

### Author: ![zzoldan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/zzoldan/32/452_2.png) [@zzoldan](https://community.glideapps.com/u/zzoldan)
#### Post date: [June 1, 2020, 2:43am UTC](https://community.glideapps.com/t/relations-question/10074/17 "2020-06-01T02:43:58Z")

</div>

How did you pair/use that column with anything else?

---

<div class="post-metadata">

### Author: ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)
#### Post date: [June 1, 2020, 2:46am UTC](https://community.glideapps.com/t/relations-question/10074/18 "2020-06-01T02:46:22Z")

</div>

You mean the reservations? It’s the last level of your data, so I don’t do anything with it. Just going from that last level backwards using UNIQUE.
