Set default value as null or blank for drop-down in PowerApps

Set default value as null or blank for drop-down in PowerApps


In our previous blog we saw how to create a cascading drop down in PowerApps using SharePoint custom list as data source. Today we will see how to set default value as null or blank for drop-down in PowerApps. We will use the same “States” SharePoint custom list in order to demonstrate this. We have used “ClearCollect” and “Collect” PowerApps formula to set default value as null or blank for drop down list. For more details on PowerApps formulae, please refer link.

In the below screen as you can see that I have created a PowerApps screen with two cascading dropdown list State and District. If you don’t know how to do the cascading please read my previous blog.

Figure 1

Setting Default value for “State” dropdown list

In order to set the default value of State dropdown list we will use “ClearCollect(collection1,{Name:””}); Collect(collection1,Distinct(States,Title))” formula on “OnSelect ” action of “StateDropdown”. On Select behaviour will run when we are clicking or selecting the dropdown list. As from above formulae we can see that on select of state dropdown first ClearCollect will run followed by the Collect.

Under Data section the Items for the State dropdown list will be “collection1” which was created using Collect formula. For better understanding please refer below screenshot.

Figure 2

After implementing the formula the State dropdown will look like below.

Figure 3

Setting Default value for “District” dropdown list

In order to set the default value of District dropdown list we will use “ClearCollect(collection2,{Name:””});Collect(collection2,(Filter(States,Title=StateDropdown.Selected.Result).District))” formula on “OnSelect ” action of “DsitrictDropdown”. We will use “collection2” to populate the items for District dropdown. Please refer below screenshot for the same.

Figure 4

 

Once we are done with the formula than District dropdown will look like below.

Figure 5

If there are any other ways to set the default values of dropdown, please let us know by replying. Thanks for visiting my blog. Please share and subscribe our site for more stuffs on PowerApps. In our next blog we will see how to create a PowerApps form for SharePoint list.

Reference:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/formula-reference

https://powerusers.microsoft.com/t5/General-Discussion/Need-Dropdown-with-blank-null-default/td-p/58172

Sharing is Caring

10 thoughts on “Set default value as null or blank for drop-down in PowerApps”

    1. Hi Joanne,
      Thanks for visiting our site. You can name the blank value to “Show All” by editiing the formula with below.
      ClearCollect(collection1,{Result:”Show All”}); Collect(collection1,Distinct(States,Title))

  1. Hi Rakesh, this has been really helpful.. i was struggling to get this done and landed in the right place i know.
    ClearCollect(collection1,{Result:”Show All”}); Collect(collection1,Distinct(States,Title)) -> this works only for a state dropdown field but not with District.

    if i use it in similar fashion for District field , it doesn’t show the result and returns blank value.
    ClearCollect(collection2,{Result:”Show All”});Collect(collection2,(Filter(States,Title=StateDropdown.Selected.Result).District))

    can you please help and suggest ?

    1. Hi Sunil,
      I am glad that article has been helpful to you.
      Instead of Result in the formula can you use Name, so the new formula will be ClearCollect(collection2,{Name:”Show All”});Collect(collection2,(Filter(States,Title=StateDropdown.Selected.Result).District))

  2. Hi Rakesh,
    Thanks for your response. i was trying to implement this on multi level cascading dropdowns, and i think i have figured it out. so in the above example, our formula will be: ClearCollect(collection2,{District:”Show All”});Collect(collection2,(Filter(States,Title=StateDropdown.Selected.Result).District)).
    passing the value of drop down field will set the blank value to custom message we pass. thank you very much once again !

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top