cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
illmatic
Helper IV
Helper IV

default blank value for cascading dropdown with ascending sort

I have a canvas app that is pulling data from a sharepoint list.  I've got two cascading dropdowns which are pulling info from the same list.  Column1 is a numeric field and Column 2 is single line of text.   I've set the first entry in the list to a blank value, however, it's still not defaulting to the blank value.  I have to have Column 1 in 'ascending' order so the numbers are in order.  how can I set a blank default value for Column 1 [which filters Column 2 to blank as well] while still keeping Column 1 in ascending order?

 

Here is what I currently have on the Items properties.

Column 1:  Items Property:  Sort(Distinct('SPLIST', Column1), Result, Ascending)
Column 2: Items Property:  Sort(Distinct(Filter('SPLIST', Column1 = Column1.Selected.Result), Column1), Result&Blank())

 

default is set to no value on both fields.  I have searched extensively but can't seem to find a solution for my specific scenario.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@illmatic 

That shouldn't have any problems for a text column.

My question though is - first, does the column definition contain a Default value for it?  If so, that would impact it not being blank.

If not, then what are you seeing?  The dropdown is set to Blank for the default and you have allowed blank values - that will always give you a blank selection.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

10 REPLIES 10
RandyHayes
Super User
Super User

@illmatic 

Items will not set a default value.  You need to use the Default property of the Dropdown in order to do that.

If you want Blank values to be shown by default, you first need to set the "AllowEmptySelection" property to true.

Then you will want to set the Default to : Blank()

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
illmatic
Helper IV
Helper IV

@RandyHayes    Thank you! This is helpful!  Unfortunately this still doesn't seem to make this fields default to blank in a new form.  It might be worth noting that the two fields that are dropdowns in the PowerApps are Single Lines of Text in the SP field itself.   I'll see if I switch them to lookup columns if that has any bearing.


Thanks for putting me on the correct path!

RandyHayes
Super User
Super User

@illmatic 

That shouldn't have any problems for a text column.

My question though is - first, does the column definition contain a Default value for it?  If so, that would impact it not being blank.

If not, then what are you seeing?  The dropdown is set to Blank for the default and you have allowed blank values - that will always give you a blank selection.  

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

1.)  The default value is set to "blank" on the dropdown, and AllowEmptySelection is set to true.  The column it is synced to is a Single Text Field in the SP List where the form will be submitted.   The dropdown gets its values from a different SP List, and that column is a number field that does not have a default value.

 

2.)  Note, the Item property of Column 1 is filtered by the Distinct function [so I only see each number ID once, and the actual Location Names that correspond to that number ID are shown in Column 2].   I also have Column 1 sorted by 'ascending' so that the number values are in numerical order.    

 

3.) What I currently see now is Column 1 prepopulated with a value of "1".  Column 2 has a blank value and the rest of the values that are filtered based on Column 1.

 

What I need is for Column 1 to default to blank as well.

RandyHayes
Super User
Super User

@illmatic 

Clarify for me...you mention the Default was set to "blank" - was that a short answer or is it really set to that?  It should be set to Blank()

Setting a Default to Blank in Powerapps is not related to the Items property at all...they can be anything and from anywhere, so the sources of the Items is not important to this.  The ONLY thing that is important is those two factors - "AllowEmptySelections"=true and Default set to Blank()

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes   short answer.  I mentioned the Items property because many other articles and questions surrounding setting a blank default for dropdowns mention you should add a 'blank' entry to the list [the first entry], so that when the values are pulled in the top option is that blank entry.   For me in particular, this tactic does not work since in Column 1, it's set to a number field, and I need those numbers listed numerically.   As an aside, the only reason that the blank is working in Column 2 is actually due to my formula in the Items Property...  adding 'blank()' to default and ensuring allowemptyselections is true had no effect whatsoever on either of the fields.

Logically, I do understand that the Items property should have no bearing on the default value, but the myriad of articles out there refute that answer in their solutions.  I just don't think it works for me because I have a numeric column and am also needing to sort by ascending order.

RandyHayes
Super User
Super User

@illmatic 

First - The articles you are reading are out of date.  PowerApps recently added the ability to allow empty selections to Dropdowns, so that removes any need to follow those instructions.

Second - Adding a blank to a data list is a BAD idea!!  Blank selections is an aspect of the User Interface.  Introducing user interface into the data list is a poor solution for that very fact - you're putting UI in the data layer!  Also, consider the future...someone sees a blank value in a list and says, oops, that shouldn't be there and deletes it...now your app is broken.

Anyway, there are better ways around that. Skip the articles.

 

Back to your thoughts - the Default value set to Blank() and the Allow Empty Selections is the only thing you need.

The items property actually is never numeric.  Even though you might think you are putting in numeric values, PowerApps will convert them to text in the dropdown.

In fact, to demonstrate this, if you put a new Dropdown on the screen, you will see that the Items property is set to DropDownSample.  That is actually a table with 3 rows in a column called Value with numeric values.

i.e. [1, 2, 3]

You will notice as well that the Default property is set to "1" so why a quoted 1 (text)? because PowerApps has converted the numbers to text.

If you put this in that Items property : Sort(DropDownSample, Value, Descending) it will be sorted reverse, but the "1" will still be default.

If you now set the AllowEmptySelection to true and the Default to Blank(), the Dropdown will still have reverse sorted numbers, but the default will now be blank.

 

As for text values in the dropdown - that follows exactly the same as above except it is already text.

 

As for your Column2 dropdown, the adding of the Blank() to the Result is not providing anything for you, it's only potentially impacting the sort as that is where you are specifying it.

 

So, I am not understanding why you are not seeing the exact same thing that in your situation.

Can you provide some screenshots or anything to demonstrate what you are seeing?

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

 

Sure thing... here are the screenshots.
Shows item property values on Column 1Shows item property values on Column 1

These are the properties that are set on the dropdown field.

 

 

 

Shows end result when "Play" button is hit.Shows end result when "Play" button is hit.

 

This is the result when I hit the 'Play' button from the Apps screen.  Note, Column 1 is prefilled with 1 as mentioned.  Facility field is blank because I've added the Result & Blank to the Items Property.

illmatic
Helper IV
Helper IV

I ended up deleting all cookies, restarting, and refreshing.  After several attempts of this, it finally loaded as intended.

 

Thanks!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,125)