Have a unique records and avoid multiple add rows

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 ?

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.

2 Likes

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

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.

2 Likes

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

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.

2 Likes

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

Thanks a lot

1 Like

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