cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

ComboBox DefaultSelectedItems

I'm just unable to get this and it's driving me bonkers.

I've got a 3 screen Browse, Detail and Edit App. I've replaced a significant number of the dropdowns with comboboxes in the edit screen datacards to allow for blank defaults, better filtering and easier waterfall selections. Everything works great EXCEPT moving from the Detail screen to the Edit Screen. I cannot for the life of me get the selected gallery record to default in the comboboxes on the edit screen. The issue I thought came down to Data type, where I have text, but the function shows me what the value or text should be.

DefaultSelectedItems1.PNG

If i just use Selected, it comes through but it pulls from column A (site name) regardless of which combobox i add it too.

 

I then tried to use AllItems instead of Selected, which gives me a data type of table with the correct selected item in the funciton preview, but nothing shows up in the combo box.

DefaultSelectedItems2.PNG

 

So then I looked at the text fields that are coming through from the Detail Screen (Project Name Field), which has a default DataCard of ThisItem.ProjectName and default DataCardValue of If(EditForm1.Mode = FormMode.Edit,Parent.Default,""). Try to use this, but nope. Just blank!

 

My new form adds to my sharepoint list correctly,  but can't edit already created rows inside of the app because of this issue. ANY HELP MUCH APPRECIATED.

 

Jason

1 REPLY 1
Highlighted
Community Support
Community Support

Re: ComboBox DefaultSelectedItems

Hi @jwim ,

Could you please share a bit more about the SBU column in your SP List? Is it a Single text type column or Choice type column?

Do you want to set the selected value within the ComboBox as Display value when you edit an record?

 

1. If the SBU column in your SP List is a Single text type column:

Set the DefaultSelectedItems property of the ComboBox to following:

If(
   EditForm1.Mode = FormMode.New,
   {
     Value: Parent.Default
   },
   {
      Value: BrowseGallery1_1.Selected.SBU
   }
)

 

2. If the SBU column in your SP List is a Choice type column:

Set the DefaultSelectedItems property of the ComboBox to following:

If(
   EditForm1.Mode = FormMode.New,
   Parent.Default,
   {
      Value: BrowseGallery1_1.Selected.SBU.Value
   }
)

Please also make sure the SelectMultiple property of the ComboBox to false.

 

In addition, if you set the Items property of the SBU ComboBox to following similar formula:

Distinct(...)

Please modify above formula as below:

If(                                          /* <-- SBU is Single text type column */
   EditForm1.Mode = FormMode.New,
   {
     Result: Parent.Default
   },
   {
      Result: BrowseGallery1_1.Selected.SBU
   }
)
If(                                   /* <-- The SBU is Choice type column */
   EditForm1.Mode = FormMode.New,
   {
Result: Parent.Default.Value
}, { Result: BrowseGallery1_1.Selected.SBU.Value } )

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (9,153)