# Working with relations and rollup values based on relations

**URL:** https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456
**Category:** Ask for Help
**Created:** [June 5, 2023, 10:56am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456 "2023-06-05T10:56:17Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Pietro\_Castellani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pietro_castellani/32/59938_2.png) [@Pietro\_Castellani](https://community.glideapps.com/u/Pietro_Castellani)
#### Post date: [June 5, 2023, 10:56am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/1 "2023-06-05T10:56:17Z")

</div>

Hello I have a problem with relations:

I have several tables with printed values that I set when Users submit the forms:

Users: with HorseSchoolID (1:1), relation with HorseID (1:n) and with Lessons (1:n)

Horse School: relations with UsedID (1:n) and HorseID (1:n)

Horse School Details: basically what’s inside a stable, the types of field and so on, printed values of Horse School ID (1:1)

Lessons: here I want the users with role “instructor” to create lessons that users can book. Every lesson should then be associated with HorseSchoolID (1:1, done), CreatorID (1:1, done) and HorseSchoolDetaildID (basically the field where it will take place…here I have a problem since the user cannot - of course - select a code in a form so I don’t know how to create this relationship).

Can someone help with that issue?

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [June 5, 2023, 11:02am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/2 "2023-06-05T11:02:37Z")

</div>

> [@Pietro\_Castellani](#):
>
> here I have a problem since the user cannot - of course - select a code in a form

Have you tried a choice component? You would need a human readable column for the choice component ‘display’ and use the horseschoolDetailID for the ‘values’

---

<div class="post-metadata">

### Author: ![Pietro\_Castellani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pietro_castellani/32/59938_2.png) [@Pietro\_Castellani](https://community.glideapps.com/u/Pietro_Castellani)
#### Post date: [June 5, 2023, 11:29am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/3 "2023-06-05T11:29:52Z")

</div>

I have done that but I don’t like it very much. It can occur that the data is duplicated in that way. Even if I set conditions in the choice form (imagine if there are 2 field of the same type with same details and only a different rowID)

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [June 5, 2023, 11:40am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/4 "2023-06-05T11:40:57Z")

</div>

> [@Pietro\_Castellani](#):
>
> imagine if there are 2 field of the same type with same details and only a different rowID

Well I don’t know your app but if you are having duplicate data then there might be a more efficient way to setup your tables.

---

<div class="post-metadata">

### Author: ![Pietro\_Castellani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pietro_castellani/32/59938_2.png) [@Pietro\_Castellani](https://community.glideapps.com/u/Pietro_Castellani)
#### Post date: [June 5, 2023, 12:14pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/5 "2023-06-05T12:14:58Z")

</div>

No ok I misunderstood your suggestion, now it works well. Last question though…if I want to display the ID related value in a component how do i do that as I don’t have the chance to select it…

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [June 5, 2023, 1:04pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/6 "2023-06-05T13:04:34Z")

</div>

> [@Pietro\_Castellani](#):
>
> I want to display the ID related value in a component

That depends on where you are trying to display the related value… if you are trying to display it in a Native form then I don’t think that will work.

You could use a custom form which essentially is a 1 row table with a bunch of user specific columns to hold all your inputs… from there it would be easy to setup the relation from your choice component.

The disadvantage to a custom form is that it can cost many updates.

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [June 5, 2023, 1:17pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/7 "2023-06-05T13:17:56Z")

</div>

Nice job on this solution, @Eric_Penn. Both are accurate:

1. Use a choice component with different value/display fields
2. Use a custom form to display related data.

Here’s an alternative to number 2 as long as there are no calculations involved:

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [June 5, 2023, 1:26pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/8 "2023-06-05T13:26:42Z")

</div>

Thanks @Robert_Petitto! Nice touch with the form container, seems like a great use case!

> [@Pietro\_Castellani](#):
>
> Last question though…

Feel free to ask questions. There are many people willing to help

---

<div class="post-metadata">

### Author: ![Pietro\_Castellani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pietro_castellani/32/59938_2.png) [@Pietro\_Castellani](https://community.glideapps.com/u/Pietro_Castellani)
#### Post date: [June 5, 2023, 1:52pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/9 "2023-06-05T13:52:03Z")

</div>

No sorry I mean to display the relationship in a table component. Now I have all the IDs and the relations/lookup in place and I see the data in the data section but when I want to display them I am not able to select them in a table/data grid component.

How can I work around this issue?

---

<div class="post-metadata">

### Author: ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)
#### Post date: [June 5, 2023, 2:49pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/10 "2023-06-05T14:49:04Z")

</div>

If I understand correctly you want to go into the settings of that component and under DATA use your relation for it’s ‘Source’

---

<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: [June 5, 2023, 3:03pm UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/11 "2023-06-05T15:03:43Z")

</div>

Is your lookup showing as an array? It may be because your relation is a multiple relation instead of a single relation. Unless I completely misunderstood the problem.

---

<div class="post-metadata">

### Author: ![Pietro\_Castellani](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/pietro_castellani/32/59938_2.png) [@Pietro\_Castellani](https://community.glideapps.com/u/Pietro_Castellani)
#### Post date: [June 6, 2023, 6:41am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/12 "2023-06-06T06:41:08Z")

</div>

Hi, no it’s not a multiple relation, it’s a single one.  
I cannot understand why it doesn’t show…

 ![img 2](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/2/d291778bab6c99dfebe9d1d81ad48609f2eeb2cd.jpeg)

 ![img 1](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/7/b/7bea9dd5f23c9ee8ee98ffbd062defcaad6cd949.jpeg)

And it’s like that for every relation, being single or multiple…I’m using glide as data source

---

<div class="post-metadata">

### Author: ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)
#### Post date: [June 6, 2023, 6:52am UTC](https://community.glideapps.com/t/working-with-relations-and-rollup-values-based-on-relations/62456/13 "2023-06-06T06:52:47Z")

</div>

Are you trying to use a relation column as an item in a Data Grid?  
You can’t do that - what would you expect to see?  
If you want to use column values from the table that the relation is matching to, then you’ll need to add one or more lookup columns, and use those.
