# Table relations

**URL:** <https://community.glideapps.com/t/table-relations/68797>\
**Category:** Ask for Help\
**Created:** [December 18, 2023, 10:06am UTC](https://community.glideapps.com/t/table-relations/68797 "2023-12-18T10:06:46Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simo/32/62132_2.png) [@Simo](https://community.glideapps.com/u/Simo)\
**Post date:** [December 18, 2023, 10:06am UTC](https://community.glideapps.com/t/table-relations/68797/1 "2023-12-18T10:06:46Z")

</div>

Hi everyone,

why can’t I relate these tables?  
I would like to obtain the ID of the user who commented

Thank you

 ![user](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/d/ddd6f90c675661cb685deb37c2c4ec0ae975d185.png)

---

<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:** [December 18, 2023, 10:14am UTC](https://community.glideapps.com/t/table-relations/68797/2 "2023-12-18T10:14:48Z")

</div>

Relations work by matching two values.  
You are trying to match the RowID value in the Comments table with the RowID value in the Users table. This will never work, because all RowIDs are unique.

What you need to do is add a column to your Comments table to store a UserID, then when a Row is added to that table write the Users RowID into that column. Then you can use that column to create a relation to your Users table.

---

<div class="post-metadata">

**Author:** ![Simo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simo/32/62132_2.png) [@Simo](https://community.glideapps.com/u/Simo)\
**Post date:** [December 18, 2023, 10:38am UTC](https://community.glideapps.com/t/table-relations/68797/3 "2023-12-18T10:38:11Z")

</div>

Now the problem is how to copy it 😄 , I could copy the iduser into the comments table, when a user registers, correct?  
Do you have any suggestions how to do this?

I thank

---

<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:** [December 18, 2023, 10:43am UTC](https://community.glideapps.com/t/table-relations/68797/4 "2023-12-18T10:43:27Z")

</div>

No, you do it when a row is added to the Comments table.  
How does that happen - do you use a form?

---

<div class="post-metadata">

**Author:** ![Simo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simo/32/62132_2.png) [@Simo](https://community.glideapps.com/u/Simo)\
**Post date:** [December 18, 2023, 11:15am UTC](https://community.glideapps.com/t/table-relations/68797/5 "2023-12-18T11:15:38Z")

</div>

maybe I understood and it seems to work, see photo.

 ![Commentsss](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/6/366fadc3967fc4a52c297239193d01dddf508ad9.png)

---

<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:** [December 18, 2023, 11:20am UTC](https://community.glideapps.com/t/table-relations/68797/6 "2023-12-18T11:20:42Z")

</div>

How is that action triggered?  
Is it an onSubmit action with a Form?  
If yes, don’t do that - it’s not 100% reliable.  
Instead, pass the UserID as a User Profile Value with your Form.

> **[Values | Glide Docs](https://www.glideapps.com/docs/reference/values#user-profile-values)**
>
> The different types of values you can work with in Glide.

---

<div class="post-metadata">

**Author:** ![Simo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/simo/32/62132_2.png) [@Simo](https://community.glideapps.com/u/Simo)\
**Post date:** [December 18, 2023, 12:22pm UTC](https://community.glideapps.com/t/table-relations/68797/7 "2023-12-18T12:22:25Z")

</div>

is activated via comments

 ![Attiva](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/2/4253d6dd39682879cb7639ccb44253d34b2924cb.png)

---

<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:** [December 18, 2023, 12:34pm UTC](https://community.glideapps.com/t/table-relations/68797/8 "2023-12-18T12:34:19Z")

</div>

Okay, I suggest you review the documentation for the Comments component.  
If you configure it as per the guide, you will get what you want.

> **[Comments | Glide Docs](https://www.glideapps.com/docs/essentials/components/collections/comments)**
>
> Allow users to comment directly in your app.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [December 25, 2023, 12:34pm UTC](https://community.glideapps.com/t/table-relations/68797/9 "2023-12-25T12:34:31Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
