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

Set default selection for drop-down in a new Form

Hello.

 

I have an app wich the data source is Sahrepoint List, that list has a "choice" item ('New', 'Closed', 'Open').

 

Is there currently a way to set a default selection in a DataCardValue (dropdown) as 'New' when ForMode is "New"?

 

Thanks in advance

15 REPLIES 15
jlarsen81
Level: Powered On

Re: Set default selection for drop-down in a new Form

It should automatically select the first choice option for the column. If you manually added the items to your dropdown, you would simply want to make "New" the first option. In the photo here you can see my dropdown items for the MaterialType column in my list. The default is simply the MaterialType in a new form as there won't be a data value, the dropdown has defaulted to the first item listed.

 

Capture.PNG

PatricioPG
Level: Powered On

Re: Set default selection for drop-down in a new Form

The problem is that I want to bind the dropdown with my Sharepoint list as data source. My datacardvalue doesn't have an "Items" propety

Highlighted
jlarsen81
Level: Powered On

Re: Set default selection for drop-down in a new Form

If you unlock, say, DataCard1, you can insert the dropdown into the datacard and delete the textbox. You will want to rename the dropdown to whatever the textbox was named, probably DataCardValue1, or something like that. Nowchange the DataCard1 update field to DataCardValue1.Selected.Value. The dropdown is where your Items property will be located, so you can either manually enter your values like this ["New","Closed","Open"], or use Distinct(SharePoint List,Column Name.Value); this will populate your dropdown either way with the options you are looking for. I would recommend manual entry as using Distinct will populate based on the order it finds the values in the column, so "New" might not be the first option in the dropdown.

PatricioPG
Level: Powered On

Re: Set default selection for drop-down in a new Form

I'm having a weird issue, the original datacardvalue has all options but when I add a dropdown and bind it with the list item only show the half of my values:

 

Original datacardvalue: [1, 2, 3, 4, 5, 6]

 

New dropdown binded with Disctinct: [1, 3, 5]

 

That's normal? Or there is something weird?

jlarsen81
Level: Powered On

Re: Set default selection for drop-down in a new Form

That sounds like a delegation issue. Distinct is not a delegable function yet, so it will only find the options that are unique in the first 500 rows of your list. I would suggest manually entering the column options in your Items property to avoid this.

bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

I feel lost and stupid (as I've done more advanced tasks than this) but things could have changed since March 2017.

I have a SharePoint list that has a "Status" column ('Choice' type) with "New", "Assigned", "Declined", "Complete" values.

If it matters, I use a "Powerapps Form" (rather than a "Powerapps App") which created a DataCard with Combobox control.

1) How do I set up a Default value to "New"?

2) How do I assign any other value to that column?

I see that "Default" property for the Combobox which should do the trick but no matter what I type in there, I get a mismatch of values.

Side note, my choice field will be read only all the time except for "Complete" status so yes, I surely could use a text field instead of a Choice and do all the changes with the same logic but I really would like to figure this obstacle out.

Thanks!

 

Super User
Super User

Re: Set default selection for drop-down in a new Form

Don't change the default value of the combo box. All you need to do is is change the default value in the Data Card associated with the combo box.

 

If(Edit.Mode = New, {
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
	Value:"New"}, 
ThisItem.Status)


--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

I use a variable that determines whether a form is new or not:

If(SPFormMode="NewForm",{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",	Value:"New"},ThisItem.Status)

But yes, it worked like a charm! Thanks!

bloodoff
Level 8

Re: Set default selection for drop-down in a new Form

Ok, how do I do the same to a Person type column (DataCard with a Combo box in PowerApps)?

This {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:""} doesn't work.

However, the same function works perfectly on any other choice field (DataCard with Combo box in PowerApps).

Thanks!

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: 164 members 4,549 guests
Recent signins:
Please welcome our newest community members: