I recently started using SharePoint Lists to connect to my PowerApp, so excuse me if this is fairly simple.
I have a main table, in which users provide a variety of information in the "editform" including country and city that the delivery has to be sent to.
I have two lookup columns for country and city, which I am connecting to the lists "Cities" and "Countries" respectively as can be seen below:
Now I would like for the list to filter down to only show the cities that are geographically located in the country I have chosen like seen below:
How do I make sure that these two lists connect so that when I choose Germany (as done on the right hand side) it will only show fx. "Berlin","Düsseldorf" and "Hamburg"?
Since you are having country as well as city in one sharepoint list, I could imagine that the Filter-function might solve your problem. It would look like that on your city combobox/dropdown:
Filter( SharepointList, Country = dropdownCountry ).City
You can then also use the Distinct-function to make sure that every city is shown only once.
Please let me know if this works for you or if I misunderstood something.
Thank you for the response! I am not sure I am following. So right now I have three Sharepoint lists:
1. main table where all information gets stored (including country and city of shipment)
Does it make sense if the "Cities" sharepoint list has the country in a column so that it can be filtered according to the country that way? In that case how do I do that?
I would just use the first of your sharepoint lists, as you have both of your needed columns, country and city, there together. Therefore there is no need to add a column to one of the other lists.
I would use the first sharepoint list for both of your item values and display each city and country.
So first your country dropdown/combobox item value can look like this (Distinct is necessary to list every country once):
And then your dropdown/combobox item value for city looks like this:
Distinct(Filter(SharepointList, Country = dropdownCountry.Selected.Result).City, City)
Hope this helps
Okay now I get it. I am trying to use the distinct function, but when I use this:
Distinct([@'Main Table'].Country, Country)
It shows an empty combobox..
The original item is:
I have been trying to write the formula with "Choices()" in it, but it gives me an error
I don't have much experience with Choices, but if this works for your country combobox then I wouldn't change it. I just showed the possible code for both comboboxes to make it more understandable. Also the code for your city combobox is the one you need to get your desired outcome, so please try to change only this code with the one I recommended. I hope this will help you.
Right I understand it now. I have managed to filter it down to the right cities. However, now another problem evolves. I am not able to save the parent.default (the chosen item in the cities combobox) after submitting the editform.
In a previous application I created using an excelsheet as datasource I put the following in the defaultselecteditems:
and in the update property of the card:
Left( Concat(ComboBox3.SelectedItems,'Senior Advisor'& ","), Len(Concat(ComboBox3.SelectedItems,'Senior Advisor'& ","))-1 )
then it would keep the information. However, the information does not get saved in the combobox now using a sharepoint list as a datasource.
Check out the on demand sessions that are available now!
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Features releasing from October 2020 through March 2021
Check out the Power Platform Community Highlights