cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thom89
Level: Powered On

Dropdowns do not fill in "play" mode

Hi everyone,

 

I have several dropdowns that are dependent on each other.

I use an excel file as my data source where all information is stored.

My first dropdown loads its items from that datasource and fills it with all distinct items from "country" in the excle file.

My second dropdown then has the items "cities", which are dependent on the selected country, and so on with other dropdowns. This works perfectly within the app creator and preview mode, but when I go into "play", the first dropdown loads all items but all others stay empty. I tried refreshing datasource and everything, no clue why it works in preview but not in play...

 

Any help is much appriciated. 

1 ACCEPTED SOLUTION

Accepted Solutions
Thom89
Level: Powered On

Re: Dropdowns do not fill in "play" mode

I solved it...

I was using the name "Location" as a column name and apparently this is some kind of internal function that should not be used. I renamed now the column to city and it works... Smiley Very Happy

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Dropdowns do not fill in "play" mode

Would you mind posting the code you are using to define the data in the second dropdown? And are you using a collection or pulling straight from Excel? While I don't have a great idea for why it works in preview mode but not play mode, I bet we can find a way to make it work! 

Thom89
Level: Powered On

Re: Dropdowns do not fill in "play" mode

Thank you for your reply.

 

Optimal would be to load the excle into a collection, but I also tried pulling directly from the excle with the same result.

 

At the moment it is like that:

OnVisible of Screen: Collect(CollectLocation;Table1)

Dropdown_Country: Distinct(CollectLocation; Country)  <-- that works in preview and play

Dropdown_Location: Distinct(Filter(CollectLocation; Country = Dropdown_Country.Selected.Result); Location) <-- only works in preview

 

I have attached also screenshots of preview and play.

 

Any help is appreciated!

Super User
Super User

Re: Dropdowns do not fill in "play" mode

Thanks for sharing your code. I made a quick test app and Excel file and your dropdown code works as expected for me, so hopefully that reinforces that your code is good!

 

Something that you may change that may or may not be contributing to the issue at hand is using Collect to gather your data in the OnVisible property. If this is a screen you are navigating to and from multiple times, it will append that data to the collection every time you do so. So if you navigate to the screen three times, you will effectively have a collection that has every item tripled. What might be better would be to use ClearCollect, which will empty and re-collect the collection on each navigation to the screen. I wouldn't think this would be an issue as the Distinct function would handle the repeated items but it is worth a look.

 

One troubleshooting item you may try is to make sure that you have saved and published your app and that the current version is on the device you are testing. I have had occasions where, after making a change, I opened the app on my phone or computer and didn't see the changes because the current version wasn't live. Sometimes it was me not publishing and sometimes it was that the newest version hadn't been pulled in to my device yet. Using the Windows 10 app seems to be the most consistant for pulling in the most recent version on first launch in my experience, so I usually launch apps there to check changes now. Doing the same on my iPhone I sometimes have to open an app three times before it gets the newest version. I hope this isn't insultingly basic and I mean no offense by suggesting it; like I said, it is something I have run into from time to time.

 

The next thing I would do to help troubleshoot would be to add a temporary data table that has the same statement as your second dropdown in the Items property. Using this to view the Result data can be helpful to see all the values that should be in the dropdown right away. If you are seeing the correct data here but not in the dropdown, I would check the other properties of the dropdown to see if anything else could be effecting it, such as the Default property or the Reset property/conditions if you are using those.

 

Another thing to try would be to change Selected to SelectedText. I saw a post on the forums recently where that simple change solved an issue so it is worth a shot. 

 

Last, in the event that nothing else works I would delete and re-add a fresh control. That has worked for me on rare occasion. 

 

Feel free to let me know if any of that helps. If not, we can give a call out to some official support to see if they can provide more insight. 

Thom89
Level: Powered On

Re: Dropdowns do not fill in "play" mode

Thank you for your detailed reply!

I tried all your suggestions and many more for two days now, unfortunately nothing is working.

I even set up a new test app and new dataset and filtered everything in diffrent galleries and then pulling the dropdown items from the gallery. All my tries work perfectly in editing and preview mode, but not in playmode...

And yes I made sure that the current version of the app is running Smiley Happy

 

I noticed that if I filter without distinct it works for the second dropdown (Cities)  that is also on the first screen but other dropdowns that are on a second screen stay empty even if they have the exact same properties.

 

No clue what else to try since it just makes no sense why it isnt working in playmode, super buggy Smiley Sad

Thom89
Level: Powered On

Re: Dropdowns do not fill in "play" mode

Some addition...

I now created three excel files which only contain the column i want to select from and the direct dependency.

The first excel file named "TestCountry" has the column "Country", file "TestLocation" has the columns "Country","Locations, and file "TestCustomer" has the columns "Locations","Customer".

 

I now collect three diffrent collections from those files with:

ClearCollect(CollectTestCountry; Table1);; ClearCollect(CollectTestLocation; Table1_1);; ClearCollect(CollectTestCustomer; Table1_2)

 

I then have three dropdowns that should show me the results as earlier explained.

The dropdowns are as follows:

 

DropdownCountry: CollectTestCountry

DropdownLocation: Filter(CollectTestLocation; Country = Dropdown8.Selected.Country)

DropdownCustomer: Filter(CollectTestCustomer; Location = Dropdown9.Selected.Location)

 

I did this to simplify the problem and have not multi access on databases and only single filters.

 

As always it works in preview, but not in play...

Pictures attached.

Somewhere is a bug Smiley Tongue

 

Any help is appreciated Smiley Happy

 

 

Thom89
Level: Powered On

Re: Dropdowns do not fill in "play" mode

I solved it...

I was using the name "Location" as a column name and apparently this is some kind of internal function that should not be used. I renamed now the column to city and it works... Smiley Very Happy

View solution in original post

Super User
Super User

Re: Dropdowns do not fill in "play" mode

Good solve! That is indeed an internal function, now that you mention it. It is used to get things like latitude and longitude from the user’s device, which explains why the play mode would be effected.

Again, great find and thanks for sharing! I know I’ll be watching my column names in the future!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 403 members 2,851 guests
Please welcome our newest community members: