# Checking text entry against table for treasure hunt game

**URL:** <https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377>\
**Category:** Ask for Help\
**Created:** [June 25, 2024, 8:36pm UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377 "2024-06-25T20:36:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [June 25, 2024, 8:36pm UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/1 "2024-06-25T20:36:20Z")

</div>

Hello all,

I am attempting to implement a game of sorts into our conference app and am having a little trouble with how to action the main feature as I’m still relatively new to Glide.

What I want:  
Users find a code IRL which they enter into a text field in the app.  
When clicking the Check My Code! button, the app first checks if the code entered is valid based on a table containing two things: The Code and a Points value.  
If the code is invalid, it displays a notification saying so and the user has to try again.  
If the code is valid then:

- The User is awarded the current points value of the code in the code table.
- The points awarded is displayed on screen.
- The points value of the code is reduced by 10.
- The user cannot gain points from this code any more.

Currently, what I have is the following:

- The Users table has 2 relevant columns: A Boolean called “Joined Hunt” and a Text column called “Code Check”.
- The user is given a free code to get them started. When they enter this into the text field, it writes their entry to the “Code Check” field and checks if it matches the first code. If it is correct, the “Joined Hunt” Boolean is checked and a new column is created in the “Hunters” table. Their name is written to a text column and 1000 points are awarded into a number column. There is also a Lookup column containing all the valid codes from a “Codes” table. This is the end of the tutorial and the page now just displays the text entry field and button. The user can now enter any other codes they find.
- When the user enters a code into the text field, it once again writes to their “Code Check” field in the User table and checks it against the lookup column to see if there is a match.

This is the point where I am stuck. I can successfully make the check against the lookup column, but I don’t know how to make it so  
a) Each user can only enter a code once  
b) The point value for the code is reduced by 10 every time it is submitted.

Is anyone able to give me some help with this? Is it possible to do?

---

<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 25, 2024, 11:41pm UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/2 "2024-06-25T23:41:06Z")

</div>

> [@Etu-IT](#):
>
> Each user can only enter a code once

In the Codes table, you can add a boolean column that is user-specific, let’s call it “Awarded?”. Add another number user-specific column, call it “Points awarded”.

When the user writes to the “Code Check” column in the Users table, create a single relation from that to the actual Codes in the Codes table. Add a lookup column to retrieve the “Awarded” boolean, and another lookup column to retrieve the “Points awarded” column.

- If there’s no match from the relation, show the “try again” notification when the user presses the button.

- If there’s a relation, but the “Awarded” lookup is checked, then show a notification that the code has already been claimed by you.

- If there’s a relation, but the “Awarded” lookup is not checked, then do the steps here:

1/Set the current points value of the code to the “Points awarded” column that is user-specific, set the Awarded boolean to true.

2/Increment the current points value of the code by -10.

3/Display the points awarded on the screen through the lookup. Add a template column to prettify it if you need, e.g: “You have earned X points”.

---

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [June 26, 2024, 1:28am UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/3 "2024-06-26T01:28:01Z")

</div>

Thank you ThinhDinh, That is an amazing help. I’ve gotten 90% of the way there but need a little bit more help with the action for checking the code.

 ![Screenshot 2024-06-26 132443](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/e/3ed6244bc738090edb5f4a5280afb21b5435fed7.png)

I don’t believe I am doing the check correctly here as no matter what I enter into the form, whether it is invalid, valid but used or valid but unused, It always displays the middle notification “Code already claimed!”. The configure condition only lets me use “is empty” or “is not empty” for the Code Check Relation column, What am I meant to be putting here?

---

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [June 30, 2024, 8:32pm UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/4 "2024-06-30T20:32:46Z")

</div>

Good morning @ThinhDinh. Are you able to offer any help for my above issue on checking the code please?

---

<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 30, 2024, 11:22pm UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/5 "2024-06-30T23:22:02Z")

</div>

> [@ThinhDinh](#):
>
> If there’s a relation, but the “Awarded” lookup is checked, then show a notification that the code has already been claimed by you.

From your screenshot, can you tell me what your Code Found column is doing? In my comment above, I expected that to be a lookup column from the Codes table.

---

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [July 1, 2024, 12:05am UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/6 "2024-07-01T00:05:03Z")

</div>

The Code Found is a user-specific Boolean in the Codes table. In your tutorial above you named it “Awarded?”

---

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [July 1, 2024, 12:06am UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/7 "2024-07-01T00:06:32Z")

</div>

Ah I think I see the problem. I missed the step of adding the Lookup to the user table for the Boolean. Let me add that and see what I get 🙂

---

<div class="post-metadata">

**Author:** ![Etu-IT](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/etu-it/32/94625_2.png) [@Etu-IT](https://community.glideapps.com/u/Etu-IT)\
**Post date:** [July 1, 2024, 12:40am UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/8 "2024-07-01T00:40:39Z")

</div>

Thank you ThinhDinh! Turns out I misunderstood some of the instructions and put the lookups in the code table instead of the user table. The game is now fully functional and is working fantastically!

---

<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:** [July 8, 2024, 12:41am UTC](https://community.glideapps.com/t/checking-text-entry-against-table-for-treasure-hunt-game/74377/9 "2024-07-08T00:41:30Z")

</div>

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