# Conditional choice field

**URL:** <https://community.glideapps.com/t/conditional-choice-field/59434>\
**Category:** Ask for Help\
**Created:** [March 20, 2023, 11:13pm UTC](https://community.glideapps.com/t/conditional-choice-field/59434 "2023-03-20T23:13:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theo](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@Theo](https://community.glideapps.com/u/Theo)\
**Post date:** [March 20, 2023, 11:13pm UTC](https://community.glideapps.com/t/conditional-choice-field/59434/1 "2023-03-20T23:13:48Z")

</div>

Hello everyone,  
I am trying to build a form with 2 choice selections :

- one for countries
- one for cities  
Once a country is selected I would like in the second choice field to display only cities related to the country selected. Is it possible to that?

What I am trying to do :

 ![Capture d’écran 2023-03-20 235609](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/e/4ec46d1d7c873eb8cd163160ba72a4a9cdcf5627.png)

Couldn’t find the topic so posting up.  
Thank you a lot ! 🙂

---

<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:** [March 20, 2023, 11:19pm UTC](https://community.glideapps.com/t/conditional-choice-field/59434/2 "2023-03-20T23:19:15Z")

</div>

Assuming your Cities table has a Country column, you can create a filter based on Screen Value. Imagine my Choice component is for the Cities choice, and the Category is the Country name that would be in your Cities table. It should be a very similar setup for you. When filtering by Screen Values, the filter looks at the values in the other components on your screen.

So, what you do is filter the Cities where the Country column in that cities table is equal to the the Screen Value of the selected Country choice.

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

---

<div class="post-metadata">

**Author:** ![Uzo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/uzo/32/22639_2.png) [@Uzo](https://community.glideapps.com/u/Uzo)\
**Post date:** [March 20, 2023, 11:20pm UTC](https://community.glideapps.com/t/conditional-choice-field/59434/3 "2023-03-20T23:20:04Z")

</div>

Yes, it is possible and easy… add a country column for cities, and use the if-else column to extract cities with the country selected in the first choice.

---

<div class="post-metadata">

**Author:** ![Theo](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@Theo](https://community.glideapps.com/u/Theo)\
**Post date:** [March 21, 2023, 12:07am UTC](https://community.glideapps.com/t/conditional-choice-field/59434/4 "2023-03-21T00:07:35Z")

</div>

@Jeff_Hager thank you Jeff it works well!

However it keeps modifying my table (both countries & cities columns) when I use the choice components on the layout :

 ![Capture d’écran 2023-03-21 010232](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/8/5835147b92932855ff7e8a33fcc68a51a51134c7.png)

Do you know why ?

My table is supposed to be :  
France - Paris  
France - Marseille  
England - London  
England - Manchester

My choice component setting is :

 ![settings](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/5/6/564bdda6f6271714b637b535669298c4d65b6019.png)

---

<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:** [March 21, 2023, 12:15am UTC](https://community.glideapps.com/t/conditional-choice-field/59434/5 "2023-03-21T00:15:30Z")

</div>

> [@Theo](#):
>
> However it keeps modifying my table (both countries & cities columns) when I use the choice components on the layout :

You’re most likely writing your choice back to the same column that you are using as the source of your choices, so it’s just overwriting them. You should be writing to a separate column, or your choices should be in a separate table.

---

<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:** [March 22, 2023, 12:15am UTC](https://community.glideapps.com/t/conditional-choice-field/59434/6 "2023-03-22T00:15:42Z")

</div>

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