cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dfin
Frequent Visitor

Dropdown default value - set to blank value?

I have an edit screen with two dropdowns controls.  The first dropdown is Client and the sceond is ClientProject.  After choosing the client, the user can seleect the specific project for the client.  The ClientProject dropdown is filtering it's list values based on the value of the Client dropdown.

 

When adding a new record, though, after I select a client, the Client Project dropdown always gets set to the first value on the list.  I would preer that it would be left blank.  Is this possible?

 

Thanks,

Dave

39 REPLIES 39
Anonymous
Not applicable

Hi and thank you for your answer, and sorry for my responding late.

 

I think I may not relate my issue in an understandable way.

 

The thing is:

The reason for me wanting to have blanks as default is that I do want my users to actually have to choose/type the data they submit. My validation works and is not an issue.

I have a form that i want to use only for creating new items in my sharepoint list. Everything is working fine.. almost... My dropdown fields are troubblesome - I got two of them (The other fields are: two "type" fields and one attachment field - these resets just fine).

 

After i submit my first form things looks fine. When I try to open my form again to make another item, my form resets all fields to my default (blanks), except for my two dropdown fields. These two fields retain values from my last input, no matter what I try, I do not really have to submit the form either, if I try to reset after just choosing a value - it stays forever.

 

I have set the default FormMode.NEW for this form, and there is no default values from Sharepoint either. So there should not really be anything from outside powerapps to cause this behaviour.

 

All the best

Henrik

 

This assumes you have a blank record in the source* used to populate your dropdown:

 Edit for clarity: I don't use the default forms, so this is how I do it. If the auto form reset does not work, I'm betting the *note below is why

Screen.OnVisible=UpdateContext({vReset:true})

Screen.OnHidden=UpdateContext({vReset:false})

Dropdown.Default=""

Dropdown.Reset=vReset

 

*The "Default" MUST be a value available within the dropdown source, otherwise it will never reset back to it. The first time a form opens it may give you a blank by default, but after that dropdown has been changed, the dropdown will only reset to a "Default" value that matches a value in the dropdown source.

I'm new to Powerapps and am having the hardest time trying to set my default values to blank.  I have the default value in my Sharepoint list set to blank and I've included a blank in my reference tables.  I have it working for one column and I thought it is because I use the following code:

If(IsBlank(ThisItem.BudgetYR),Blank(),ThisItem.BudgetYR)

 

however, I try the same code in a different column (both columns are setup as dropdowns referencing tables), but it isn't setting the default value to blank

 

If(IsBlank(ThisItem.Category),Blank(),ThisItem.Category)

 

Would you know what I'm doing wrong?

Anonymous
Not applicable

Hi @ruth

 

First, for some reason I do not know, everything seemes to work for me now.

 

My sharepoint list

Is set up to have only values I want as valid datainput - read no blanks in my SP-choices. All of my dropdownfields are required, none have any default values.

 

 

In PowerApps (I hope i dont make this messy by inserting XX where names only make sense to me)

I do use a form and I only use that form to create new items.

The defaultmode is set to "FormMode.New".

The OnReset is set to "NewForm(XX)"

My datacards have:

the Default fields set to: "ThisItem.XX",

the Update fields set to: "DataCardValueXX.Selected".

 

Then "inside" my datacards I have set the values like this:

the Items fields set to: "Choices('XX'.XX)",

the InputTextPlaceHolder or Hint text is set to something that helps the user to understand what this field is all about. And by not having the blanks as default this hint text shows in the app and I like that 🙂 ,

the dropdown datacards in my form has the Default fields blank as in I have not typed in anything here... not even BLANK(),

the DefaultSelectedItems fields are set to "Parent.Default".

 

And again.. I do not know what has happened since my last post in this thread.. but now it all of a sudden worked and has been since. There i a chance though that I may have tried to delete my old form and start over. If it is not too much trouble for you i recomend doing that.

 

I'm not good enough at reading your formulaes, so I can only hope this may help you in any way.

 

all the best

Henrik

 

@ruth I would follow @Anonymous's suggestion and start over if possible. Sometimes I think there are data we can't see tied to objects that just doesn't fix itself, or more likely for me, something I clicked on/off of and never notice again no matter how many times I go thru the settings.

 

I'm not sure how your list is designed. I think what you did was have a list for BudgetYR containing acceptable values, then your main list has a column BudgetYR which is a "Lookup" column using values from the other list? Perhaps you did something else...let us know if starting over doesn't help.

 

FYI, I tried two different methods and had no issues:

  1. Created SharePoint list with a "Choice" column called Category, entered in choices, made sure "None" was selected for default value
  2. Created list "choices" with each record being a choice(I just used Title column), and another list "base" with a column named lookup choice of type "Lookup" pointing to choices list, Title column.

Both these options work fine with the default form created when I click "PowerApps > Create an app". They reset to blank fields as expected. This is why I think starting over might be of benefit. In my #2 method (the one I think you may be attempting), the Dropdown.Default is blank and Dropdown.DefaultSelectedItems = Parent.Default

 

Hope this helps!

 

Edit: Had wrong list/column name in my explanation #2. Hope I didn't confuse

Hi, @Anonymous & @strategery, sorry to be responding so late.  I was able to get the BudgetYR and Category working only because I set a default year for BudgetYR and I did enter a blank value in the Category list - which in hindsight, I think I'd rather not have a blank, however, it's working for now.  The one field that I cannot have a blank value in the list is my Vendor field.  I'm not using a Lookup in this list as I'm storing text fields in my list.  This might be my problem. I can't use a lookup because my list resides on another Sharepoint site.  

Ruth here is how you can recreate LookUp columns in SharePoint using PowerApps.This works across site collections also. 

 

For setting the default blank value I usually create a - as the first item in my list of choices and use that as the default. Not perfect but better than nothing. 

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

@ruth I highly recommend you watch @Shanescows video. He covers some of the irritating quirks as well.  Similar to Shane inserting a "-" into the records, I tend to enter something like (choose one), set my dropdown Default to "(choose one)" (quotes included), then use Visibility to hide the "Save" button on my form if any dropdown = "(choose one)"

 

Example for Vendor: Set Visibility on your button to

 

Dropdown1.Selected.Vendor <> "(choose one)"

 

Example with 2 dropdowns: Set Visibility on your button to

 

(Dropdown1.Selected.Vendor <> "(choose one)") && (Dropdown2.Selected.Category <> "(choose one)")

 

 

 

@Shanescows I watched your video, good info. Here's how I tackle blanks by default, for a couple reasons...one, I have no dummy records, and two, cascading dropdowns tend to filter much faster with collections.

Screen.OnVisible = ClearCollect(tempCollection,{Vendor:""},'SPList_Vendors')

Dropdown1.Items = tempCollection

Dropdown1.Default = ""

(This creates a collection from existing data plus a record you manually entered that is blank...no blanks in actual source needed)

Hi, Shane, thanks, I do really like your videos. 

 

I'm tripping over myself here, I thought they were referring to an actual lookup on the sharepoint list vs creating a text field and creating the lookup behavior on the powerapp.

 

Thanks for your videos.  They're great!!!

Thank for a solution of blank row in collection.

 

I was looking for this all internet.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,260)