cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sienna
Level 10

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

That would not be a grat idea. Imagine that you will change dropdown items based on user inputs. For example if checkbox is checked filter datasorce one way for dropdown otherwise filter datasource other way for dropdown. What option in this situation should PA gives you then?
AlexPaw
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

I'd just want to avoid my dropdown-based form to be empty, and left without explanation. Right now it looks like that - all the fields are empty:

 

obraz.png

 

Default value is defined for every item in Sharepoint, and I'd just expect PA to preload and preset my preffered value

 

obraz.png

It sounds relatively easy to do, but the amount of hacks to get this done is terrifying. Or am I missing something obvious here?

Just to restate the steps I took:

1) Hardcoding value doesn't work, because data card expects a Record but is given a text

2) Records are not being preloaded until someone presses "arrow down", so I don't have anything to select to.

3) Tried a variety of different formulas but I just didnt find one that works.

 

I'm kind of green to the whole PowerApps thing, I love the idea but every attempt I make is a bit in the dark

 

Thanks for any help in advance on that

Alex

 

Sienna
Level 10

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

I would recomed you not to use forms. This one feature I really hate in PA. It makes one thing simple and other things complicated or imposible to do. Dropdown default property is very easy to set. All you have to remember is to set line of linked datasource and not a column. Like
First(myDatasource). Or
First(Filter(myDatasource(Name:”ShowThis”))
That is it. It can’t be more easier that that
strategery
Level 8

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

I really tried...I went back to see what you were doing with SharePoint and made a test form etc.. Actually it's a pretty neat feature if you're just working with SharePoint lists. Unfortunately what I tried doesn't currently work, but you might keep it in your back pocket in case they ever fix it. It's also useful if you ever need to use the 'Patch' function.

 

See the 'Defaults' function for PowerApps:

https://docs.microsoft.com/en-us/powerapps/functions/function-defaults

 

What I tried to do was set 'Default' for the dropdown to 'Defaults(spList).choice'. The way the 'Defaults' function works is it asks the data source for "default" values for each column/field and creates a record of those values that you can look at. Unfortunately SharePoint does not currently return this information...per the link I provided:

"Data sources vary in how much default information they provide, including not providing any at all. When you work with a collection or another data source that doesn't support default values, the Defaults function will return an empty record."

Sienna
Level 10

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

@strategery

Ohh... Hold on... I thought we are talking about Default property of dropdown and not Defaults of Patch function. So what exactly are you trying to do?.. Sorry if I get a bit out of context 

strategery
Level 8

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

@SiennaNo you were good. I was hoping Defaults would return the values @AlexPaw had set via SharePoint. The purpose of Defaults appears to be to ask the datasource to provide the "default" values for each field/column and store it in a record. For SharePoint and the SQL server I tested, it provided a full record (so that you have all neccessary columns/fields), but left each column/field completely blank.  I suppose some datasources will actually return the values but so far no luck on what I tried. The fact SharePoint doesn't return the default values for the choices is probably why PowerApps can't populate it in the first place. Shame it doesn't work out of the box this way.

NhungL
Level: Powered On

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

This is just to share that the formula below for the DataCard Default works for me:

 

LookUp(Choices('SPListName'.SPFieldName),Value="SpecificValue")

 

Remember to replace 'SPListName' and 'SPFieldName' with the actual SP List name and Field name, and "SpecificValue" with the choice value you would like to set as default.

 

 

Highlighted
WHPM
Level: Power Up

Re: How to set a pre-populated default value of a Dropdown in EditScreen for a SharePoint Choice fie

Helpful resources

Announcements
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

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 115 members 4,433 guests
Please welcome our newest community members: