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

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
Helper I
Helper I

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

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

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.

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?

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
Kudo Collector
Kudo Collector

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!

 

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.

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!

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
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 (2,907)