cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rhiheu
Advocate III
Advocate III

Combo Box default value populated from SP list based on selected value of another Combo box

Hi,

I'm struggling to get my default value of my Combo box (LocationComboBox) to load based on the selected value of another Combo box (CustComboBox). This is the setup:

  • In the first SP List ('CustomerList'), each item has both a customer reference ('CustRef') and an assigned location code ('AssignedLocationCode') which references the site of their booking - this is assigned by another system.
  • In the second SP list ('LocationList'), each item has both a location code ('LocationCode', which is the full listing of those codes that are that are assigned in the first list by the external system), and also further descriptions about that site - 'LocationName', 'LocationAddress' etc.
  • The user selects a value (single-selection only allowed) in CustComboBox from CustomerList. The default value is ThisItem.CustRef

The LocationComboBox shows a list of all place names (LocationName) from LocationList (single-selection only as well). I would like it's default value to be the LocationName stored in LocationList, based on the matching assigned site code of the CustRef selected in CustComboBox. 

So far I have (for LocationComboBox's default):

 

LookUp(LocationList,LocationCode=CustComboBox.Selected.AssignedLocationCode,LocationName)

 

It works in a text input field, but not sure how to make it work for a Combo box field.

Any help appreciated, thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @rhiheu :

Do you want to set the LocationComboBox's default options based on the selection in CustComboBox?

Do you want to display the options in LocationComboBox's as LocationName?

The point is the combo boxs DefaultSelectedItems property.

Ive made a test for your reference:

Set the LocationComboBox's property to:

Items: 

LocationList

DefaultSelectedItems:

LookUp(LocationList,LocationCode=CustComboBox.Selected.AssignedLocationCode)
DisplayFields: ["LocationName"]

SearchFields: 

["LocationName"]

I think this link will help you a lot:

Combo box control in Power Apps

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @rhiheu :

Do you want to set the LocationComboBox's default options based on the selection in CustComboBox?

Do you want to display the options in LocationComboBox's as LocationName?

The point is the combo boxs DefaultSelectedItems property.

Ive made a test for your reference:

Set the LocationComboBox's property to:

Items: 

LocationList

DefaultSelectedItems:

LookUp(LocationList,LocationCode=CustComboBox.Selected.AssignedLocationCode)
DisplayFields: ["LocationName"]

SearchFields: 

["LocationName"]

I think this link will help you a lot:

Combo box control in Power Apps

Best Regards,

Bof

View solution in original post

Hi Bof,

I assumed with the 'DisplayFields' part you meant enter that under the separate DisplayFields property, not under DefaultSelectedItems, then it worked perfectly, thanks!!

Thanks for the Combo box control in Power Apps link too. I had made the assumption that 'Default' was for single-selection only Combo boxes and 'DefaultSelectedItems' was for multi-selection Combo boxes. Do you know what is the purpose of the 'Default' field for Combo boxes? Just for my future reference. I've tried googling for an answer to this to no avail.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (71,306)