# How to show duplicates values?

**URL:** <https://community.glideapps.com/t/how-to-show-duplicates-values/66298>\
**Category:** Ask for Help\
**Created:** [September 19, 2023, 4:07am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298 "2023-09-19T04:07:35Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [September 19, 2023, 4:07am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/1 "2023-09-19T04:07:35Z")

</div>

Hello Gliders,

I am currently making an app that would help recruit teams into a football tournament team. I want to ask how I can use Glide to check for some conditions as follows:

- The teams will have 7-12 players and each will be identified with a Name/ID.
- The data of the team will be pulled from a Google sheet, and the data of each player will be pulled from columns ;

> Email /Team Name / Name 1 / ID 1 / Name 2 / ID2 / Name 3 / ID 3 /…  
> 1  
> 2

- I am using the array formula to check for duplicates with COUNTIF and if the results return a value \> 0, Glide will disable some of the functions of the app for the user.

I like to ask how I can display the duplicate Name/ ID values to the users that will display which Name/ ID is duplicate. Currently, I can only put a hint that says **“Found ID Duplicates”** and the user will have to find who is the duplicate by themselves.

Much help would be appreciated.

---

<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:** [September 19, 2023, 6:37am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/2 "2023-09-19T06:37:46Z")

</div>

When you say duplicates, I assume that you mean duplicate names within a single team, yes?

Let me first say that this would be much easier to deal with if you restructured your data a bit.  
What I would do is just use two columns for each team. One for the team name, and then a second column being a joined list of player IDs. With this approach you could use a multi-select choice component to assign players to teams, and it would be impossible to have duplicates in the first place.

That said, given your existing structure, probably the simplest approach I can think of would be as follows:

- Create a template column that concatenates all the player IDs, and returns a comma separated list.
- Pass that list into a JavaScript column that processes the list and returns the IDs of any that are duplicated.

---

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [September 19, 2023, 7:09am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/3 "2023-09-19T07:09:47Z")

</div>

Thank you, Darren.

- The duplicates can also happen in multiple teams, for example, Team Z, can also have a player from Team A or B.
- The players’ data is collected through Jotform and then passed to Google Sheets. So I cannot make a choice component to assign players to the teams.

As for right now, there are about 70 teams with a total players around 700 players. I am not sure that it will make Glide unresponsive but I will try to implement what you have suggested.

---

<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:** [September 19, 2023, 7:23am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/4 "2023-09-19T07:23:36Z")

</div>

Okay, if you need to check across all teams, then you will need a joined list column to gather the lists for all rows, and then process that.

Question: Do you have a separate table that lists all of the PlayerIDs?

If you do, or can create one, then here is a simpler approach that doesn’t require JavaScript:

- Create a Make Array column in your Teams table that generates an array of PlayerID’s from your 12 PlayerID columns.
- In your Users table, create a _multiple_ relation column that matches the UserID’s with the array of UserIDs in your Teams table.
- Now add a Rollup column that takes a count via the multiple relation.
- Any Users that return a count greater than 1 are duplicated, and if you want to know which teams they are duplicated in, you can use a Joined List column via the same multi-relation to get a list of team names.

---

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [September 19, 2023, 8:58am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/5 "2023-09-19T08:58:16Z")

</div>

Following your instructions, I’m not sure if I missed something or might have done something wrong. Here’s a screenshot.

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/6/9625b0ddff7dc4c5f87577b7f69a7683bf6bc80d.png)

Here is the table structure in the app.  
Form Responses : **Email** / Team Array  
Users : **Email** / _lookup Team Array_

Relations | Users: Team Array with Form Responses: Team Array (Match Multiples)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/4/34bd36de28926624f6d0211b5c529623181aac97.png)

It seems there’s nothing to let the rollup function count.

---

<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:** [September 19, 2023, 9:24am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/6 "2023-09-19T09:24:40Z")

</div>

Which table is your first screenshot from? I can’t tell.

> [@Tharaporn\_T](#):
>
> Users : **Email** / _lookup Team Array_

Do you mean you have a lookup column in your Users table? That isn’t what I suggested. Please take another look at my instructions and follow them carefully. I tested the solution with some dummy data before posting, so I know it will work if setup correctly.

---

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [October 3, 2024, 8:49am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/7 "2024-10-03T08:49:05Z")

</div>

Hi Darren,

Thanks for your suggestions. This year, I’ve made adjustments to the team registration. Users have to add the players in a separate table which checks the player’s ID more efficiently.

I am currently testing how to prevent the form submission if there is a duplicate Player’s ID entry. An error hint will show if the user inputs a duplicate ID using player self-relation.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/9/9/99723792b1ae3d90de9f16fd8d33ea9f876c1ba4.png)

The action will always show “dupe” even if the ID wasn’t duplicating.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/6/56026b392d46d7047730587a0cdc94b9612ff866.png)

Can you give some suggestions? Thank you 🙂

---

<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:** [October 3, 2024, 11:45am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/8 "2024-10-03T11:45:31Z")

</div>

Is the action checking if ID equals itself? A value will always equal itself.

I would add a relation that uses the entered ID to link to the player table. If the relation is not empty, then it’s a dup.

---

<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:** [October 4, 2024, 1:03am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/9 "2024-10-04T01:03:38Z")

</div>

> [@Tharaporn\_T](#):
>
> I am currently testing how to prevent the form submission if there is a duplicate Player’s ID entry. An error hint will show if the user inputs a duplicate ID using player self-relation.

Are you doing this inside a form or a details view?

---

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [October 4, 2024, 3:11am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/10 "2024-10-04T03:11:14Z")

</div>

@ThinhDinh Yes, it’s inside a form component.

@Jeff_Hager I might have done it to check the duplicate in the first place.  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/c/dc70d205096733e83fac3628b3f73a77e5d7d21f.png)

---

<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:** [October 4, 2024, 4:16am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/11 "2024-10-04T04:16:52Z")

</div>

I would think it’s not safe to do that in a form environment. You’d better work with a custom form.

---

<div class="post-metadata">

**Author:** ![Tharaporn\_T](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/tharaporn_t/32/64209_2.png) [@Tharaporn\_T](https://community.glideapps.com/u/Tharaporn_T)\
**Post date:** [October 4, 2024, 8:55am UTC](https://community.glideapps.com/t/how-to-show-duplicates-values/66298/12 "2024-10-04T08:55:58Z")

</div>

Thanks for all the help so far. I finally made it work by checking the user who registered the [ID] first and preventing other users who tried entering with the same [ID] again.
