We are in the middle of a Power Pizza Blog Series! I am walking through lessons learned while building a Power App to track your Pizza Crawls. This will allow your friends to submit their locations, enter ratings and view the winner. Finally, a scientific solution for finding the best pizza!
I wanted this Power App to be reusable for multiple Pizza Crawls so the first screen allows you to select which Party/Event you are attending. Then this should stick through the session so everything would automatically link or filter by that party.
This included pre-populating several drop downs with the same value on records being submitted and filtering some lists based off that value.
Sticky Option Sets
There were two steps to this process. First, ensuring only one Party could be selected. Second, grabbing the one value from that first option set and adding it to the other. I fiddled with these equations for a while so lets look at the solution.
First, I changed all the options to allow only one selection. Then I set the default value for the other options using the SelectedItems property. Even though just one item is selected we still need to use SelectedItems. I kept trying to add additional properties but these are unnecessary.
Not sure I fully understand why this works but it does!
Filtering Lists By Option
Getting this piece working was the hardest part of this app. I struggled with it for far too long. There were two places I wanted to add filtering:
- When creating a rating, you select the location that rating is for. I wanted this location list to only show locations relevant to the related Pizza Party
- When reviewing scores for the different locations, I wanted this list to only show those for the related Pizza Party
I knew both of these problems would have a similar solution but was struggling to figure out what that was. I kept getting a data validation error on comparisons I was trying to do.
Finally, I figured out the formula I was looking for:
Filter('Pizza Locations', 'Pizza Party'.'Pizza Party' = PartySelectorHOME.Selected.'Pizza Party')
The issue was that I wanted to write ‘Pizza Party’ = PartySelectorHome.Selected. I kept switching between Selected and SelectedItems and I did not realize that I needed to specify the ‘Pizza Party’ attribute (actually the GUID) for both of those items.
Lesson learned: Many problems are solved with more Pizza!
You may already be seeing some foreshadowing for an upcoming post on Naming Conventions. Stick with me to see what else I learned through this #PowerPizza series!