# Would like a way to group a list by city

**URL:** <https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060>\
**Category:** Ask for Help\
**Created:** [January 29, 2020, 11:19am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060 "2020-01-29T11:19:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 29, 2020, 11:19am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/1 "2020-01-29T11:19:18Z")

</div>

I have a list view on a page in my app.

 ![Screen Shot 2020-01-29 at 1.36.50 PM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/5/5646fc5261fc7a28910eef546821673834b365e6.png)

At the moment this works fine because there is not much data but I would like to figure out a way to make it so that cities don’t repeat but they group. So you would click on a city and then the city button opens a list of the sites available in that city and you click on the individual sites to see their info.

Background info that might be helpful. I am collecting information about when repeating events happen had specific locations. I have a form that users can fill out that will summit the data then all that will be needed is for someone to occasionally check it and tidy it up for it to spit into the app correctly.

---

<div class="post-metadata">

**Author:** ![JackVaughan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jackvaughan/32/49023_2.png) [@JackVaughan](https://community.glideapps.com/u/JackVaughan)\
**Post date:** [January 29, 2020, 11:28am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/2 "2020-01-29T11:28:16Z")

</div>

You will need to use the relation column to link locations to cities. I have made a sample app that you can clone: [https://citieslocations.glideapp.io](https://citieslocations.glideapp.io)

Then once you have done this, add an inline list on each city’s details screen and choose the ‘Location Relation’

This would all be done on the ‘Cities’ tab - but your form would populate to the ‘Locations’ (or in your case ‘Sites’) sheet.

---

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 30, 2020, 4:43am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/3 "2020-01-30T04:43:28Z")

</div>

Thank you! That is what I need but now I have a follow up question. Is there a way to remove duplicates? I have set up a formula to pull the cities from the user submitted form. But just pulling it directly will mean that there will be duplicates.

Is there a formula I can add or would that be a script that would need to be written (still working on learning scripts!).

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:** [January 30, 2020, 4:57am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/4 "2020-01-30T04:57:08Z")

</div>

Look into using UNIQUE or using queries with Group By.

---

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 30, 2020, 10:13am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/5 "2020-01-30T10:13:18Z")

</div>

Jeff Thank you!  
I got it to work with this: =Unique(QUERY(‘Suggested Edits’!A4:A))

I am learning so much, which I am using for ideas for other apps! Thank you Jeff and Jack for your help with this one!

---

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 30, 2020, 12:09pm UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/6 "2020-01-30T12:09:11Z")

</div>

So I thought I had it but, I don’t.  
I can get the cities to show up as a list, I have created the relationship on the data page which has grouped the cities how I want, I have gotten the map view to work, but it is only showing one entry on the map.

Any thoughts were I might have gone wrong. I have tried a side by side comparison of the app example but I can’t seem to find it.

---

<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 31, 2020, 2:22am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/7 "2020-01-31T02:22:36Z")

</div>

Do you have any screenshots? Where do you have the map? Is it after you click on a city? I’m assuming you have a unique list of cities. You then click on a city to view it’s details. In there you have an inline list of sites for the city that you are viewing as a map. When you set up the relation, did yo click on the Multiple checkbox?

---

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 31, 2020, 5:11am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/8 "2020-01-31T05:11:52Z")

</div>

I followed the template that Jack sent. So you have a list of cities, You click on them and you get a map that shows the different locations in that city. On his version both locations in 1 city appear. On mine I get one pin and only one location.

I did click Multiples allowed and I see that it identifies both locations on the data/relationships column.

I do have an inline list for the cities.

 ![Screen Shot 2020-01-31 at 8.10.51 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/e/e7d6f9862786b5a880cedf2e4ac7752314d309da.png) ![Screen Shot 2020-01-31 at 8.11.01 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/c/c911966a93804c330f0ee264be27e0b2ee3eecdb.jpeg) ![Screen Shot 2020-01-31 at 8.11.12 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/9/9a455e66d647c65d9c6cdb6854715f5a4ae7b86c.png) ![Screen Shot 2020-01-31 at 8.11.17 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/9/901ef7f4702c0456468065bee6291049ffdffcd1.png) ![Screen Shot 2020-01-31 at 8.11.29 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/2X/0/03ac8cbf6ce701ff4f3f8800496b20f8be4f7d4e.jpeg)

---

<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 31, 2020, 5:32am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/9 "2020-01-31T05:32:54Z")

</div>

I think the pins are there. Your last screenshot looks like 2 pins almost on top of each other. I’m not sure why it’s zoomed out so far. What happens when you zoom in on the map? What do the addresses look like?

---

<div class="post-metadata">

**Author:** ![caryghart](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/caryghart/32/2670_2.png) [@caryghart](https://community.glideapps.com/u/caryghart)\
**Post date:** [January 31, 2020, 7:28am UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/10 "2020-01-31T07:28:05Z")

</div>

It was not showing two pins and the pin wasn’t even correct for either address. I am just going to put it in list view and call it a day at this point. Thank you for your help.

---

<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:** [February 1, 2020, 6:40pm UTC](https://community.glideapps.com/t/would-like-a-way-to-group-a-list-by-city/4060/11 "2020-02-01T18:40:51Z")

</div>

My only concern is that the address column isn’t a complete address. Hard to say without seeing what it looks like. You could always obtain the coordinates for the address and use that instead.
