clear the current selection of a City list when the Country list got changed

Valued Contributor

I have the following 3 SharePoint lists:-

1) Country List

2) City List. Contain a Lookup field named Country >> which reference the Country list.

3) Location List. Contain a Lookup field named City >> which reference the City list.

 

Now i am customizing the Location list SharePoint form using power apps. and since i am not storing the Country inside the Location list >> so  added a Country Combo Box inside the form, as follow:-

country.png

 

now i want to cascade the City list based on the Country selection, so inside the Country Combo box field's Items property i added the following formula:-

 

AddColumns(Country As _country,"_cities",Filter(City_1, Country.Id = _country.ID))

 

and inside the City ComboBox field's Items property i added the following formula:-

 

ComboBox3.Selected._cities

 

now i will get the cascade effect on the City list.. but i am facing these 2 issues:-

1) When i edit an item >> the City list will only show the current selection, and will not show all the cities for the current Country as follow:-

alberta.png

So the city Combo Box will be as if it is a Text field and not a list.. now only if i change the Country option >> the City list will be populated correctly.

 

2)  Second issue >> when i edit an item >> and i change the Country >> the current City selection will still be show.. so i will have a City that does not belong to the newly selected Country.. so how i can clear the current City selection when choosing another Country?

 

Thanks in advance for any help.

0 Replies