So I have a bit of a complex (at least for me, lol) Sharepoint list form in Powerapps. What I want to accomplish in some fields is having dependent dropdowns depending on what was chosen on a 1st dropdown. This is for Country/State/City/District. I'm populating those fields on Excel files that have that data for the two countries I need. The flow I wanna create would be for example:
-Choose USA in that 1st dropdown (country)
-Then the next will show Texas, NY, etc. (state)
-The next if you chose NYC, will show NYC, New Jersey (city)
-The next will show Brooklyn, Manhattan (district)
I got that to work with my two countries following these steps:
- Each Data Card has 2 dropdowns, depending on what country was chosen. I set the "Visible" property depending on the Selected.Value of each.
- Once each one is visible, these are the following properties in each one (same code, only changing the Excel file or table name)
In the OnChange of the State DataCard
If(
!IsBlank(ComboBox2.Selected);
Set(
ProvinciasFiltradas2;
Filter(ExcelTable; State = ComboBox2.Selected.State)
)
)
So it creates "ProvinciasFiltradas2", that I can then use in the following comboBox to have the cities of that state.
Items set to "ExcelTable" for that State DataCard.
-Then the City DataCard, same process for the OnChange:
Items this time is set to ProvinciasFiltradas2
If(
!IsBlank(ComboBox3.Selected);
Set(
ProvinciasFiltradas;
Filter(ExcelTable; City = ComboBox3.Selected.City)
)
)
And for District DataCard, items is set to "ProvinciasFiltradas"
All columns in Sharepoint are text type.
For other list when I'm sending a combobox data to a text column in Sharepoint, I've used {SharepointColumnName: Parent.Default} in the DefaultSelectedItems so that it retains the info saved on the App once you go to edit already created items.
Each datacard was changed on the Update property:
If(
DataCardValue11.Selected.Value = "USA";ComboBox2_1.Selected.State;
DataCardValue11.Selected.Value = "UK";ComboBox2.Selected.State)
So that it updates to the correct country
However I'm getting this error when trying to use the app from Sharepoint: "
Error when trying to retrieve data from the network: Expression "State eq null" is not supported. clientRequestId: 7ee5c48a-49c3-4575-b6a3-4a09d28e459a serviceRequestId: 8668a307-e069-41a2-9365-cdf4e8e2fefc; 1dd0a953-376d-4929-8a9e-e61194d367a1; 684F3C68-C175-4937-AE16-AA613D868E8C"
Another identical error but with ""District eq null" this time. I am unable to test if this happens if those fields are not blank, as the app doesn't retain the selected items, so every time you open an item, everything will be blank.
still.. Dunno why I'm getting that error, becase when I use the "Set" code, I'm also using the !IsBlank, so it should only "Set" that when is NOT blank....
But anyway. If you know a way to fix this, or even a simpler method to acheive this... As I would like to only have 1 combobox per DataCard, but couldn't figure out the conditionals for that.
Anyway, apologies for long post but really appreciate your input!