# Have a unique records and avoid multiple add rows

**URL:** <https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794>\
**Category:** Ask for Help\
**Created:** [January 20, 2024, 8:31pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794 "2024-01-20T20:31:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alain\_Boufler](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alain_boufler/32/57427_2.png) [@Alain\_Boufler](https://community.glideapps.com/u/Alain_Boufler)\
**Post date:** [January 20, 2024, 8:31pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/1 "2024-01-20T20:31:59Z")

</div>

I have a T-Tournament table (Uniqkey, description, date, …)  
I have a T-Reservation table (Uniqkey, date, Users)

I have a button that adds a Row to the T-Reservation table with T-Tournament and User data, for a User

But, if the User clicks several times, he will add several records. Grrrr

Solution 1: Show the button only if the User has not already registered (UniqKey + User)  
But how ?

Solution 2: Prevent adding the row if (UniqKey + User) already exists in the T-Reservation table.  
But how ?

---

<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:** [January 20, 2024, 10:38pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/2 "2024-01-20T22:38:07Z")

</div>

If you create a relation or query linking the Tournament table to the Reservation table using the tournament key, you can put a visibility condition on the button to only display if the relation or query is empty.

---

<div class="post-metadata">

**Author:** ![Alain\_Boufler](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alain_boufler/32/57427_2.png) [@Alain\_Boufler](https://community.glideapps.com/u/Alain_Boufler)\
**Post date:** [January 21, 2024, 10:31am UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/3 "2024-01-21T10:31:37Z")

</div>

Hi Jeff,  
Thanks a lot for your answer.  
This solution was already tested, but If another User makea reservation, all user cannot reserve anymore.  
I need to check USER and TOURNAMENT KEY. With Relation, I can use only one field

---

<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:** [January 21, 2024, 1:39pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/4 "2024-01-21T13:39:03Z")

</div>

Well, you can use a template column to join the user and tournament into a value to use for your relation, or you can simply specify tournament and user in a Query column. It’s doable. Just need to check both values.

---

<div class="post-metadata">

**Author:** ![Alain\_Boufler](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alain_boufler/32/57427_2.png) [@Alain\_Boufler](https://community.glideapps.com/u/Alain_Boufler)\
**Post date:** [January 21, 2024, 6:13pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/5 "2024-01-21T18:13:20Z")

</div>

In table T-REGISTRATION, I have Tournament-id, and email.  
In the Query, I can compare CurrentUser/email with T-Registration/email  
but (don’t have the selected Tournament) with T-Registration/email

---

<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:** [January 21, 2024, 6:19pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/6 "2024-01-21T18:19:17Z")

</div>

Use a query column. Query where tournament id \>is \>this row \>tournament id and user email\> is signed in user (or user id \> is \> user \> user id).

If query is not empty then user already registered.

---

<div class="post-metadata">

**Author:** ![Alain\_Boufler](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/alain_boufler/32/57427_2.png) [@Alain\_Boufler](https://community.glideapps.com/u/Alain_Boufler)\
**Post date:** [January 21, 2024, 7:20pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/7 "2024-01-21T19:20:08Z")

</div>

![2024-01-21 20_14_25-Window](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/8/582c2f6996d7f8bac3def55f7a4d275a148091c1.png)

T-Registration - Template to create a unique key (tournament-id + User-id)

- R-Key-Tour-User

T-Tournament - Template to create a unique key (tournament-id + User-id)

- C-Key-Tour-User

T-Tournament - Lookup on R-Key-Tour-User  
C-lookupReg

RULES on Button  
T-Tournament - C-Key-Tour-User not included in C-lookupReg  
 ![2024-01-21 20_20_34-Window](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/0/50dd53bd20871afd107eb893c1dec9efaea779e3.png)

Thanks a lot

---

<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:** [January 28, 2024, 7:20pm UTC](https://community.glideapps.com/t/have-a-unique-records-and-avoid-multiple-add-rows/69794/8 "2024-01-28T19:20:44Z")

</div>

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