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

Combo Box that filters to the selection in another Combo Box with lookup/filter/sort

Hi Everyone,

 

My first Power App, so I have a basic question.  I have two combo boxes on a form:

BPNJMC1_0-1623592517444.png

Both are searchable, single selection, currently display a list of Program names and Program Subtype names, and save the corresponding selected key/id to a Referrals table.

  • bpn.Referrals table = ReferralKey, ProgramNameKey, ProgramSubtypeKey, ... [other fields]
  • bpn.Programs table = ProgramKey, ProgramName, ProgramIsActive, ... [other fields]
  • bpn.ProgramSubTypes table = ProgramSubTypeKey, ProgramSubtypeName, ProgramSubtypeIsActive, ...[other fields]

I'm trying to get Program Subtype combobox (crdProgramSubtypeKey_r / cboProgramSubtypeKey_r) to:

  • continue to display the ProgramSubtypeName and save the ProgramSubTypeKey
  • filter to the subtypes for the selected program (crdProgramKey_r / cboProgramKey_r)
  • search the ProgramSubtypeName using StartsWith
  • sort alphabetically on the ProgramSubTypeName

I'm having trouble figuring out the syntax and which properties to change.  The current settings for the two combo boxes is pasted below.

 

Thanks,

J

BPNJMC1_1-1623593204016.png

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BPNJMC1
Helper I
Helper I

I finally figured it out.  Here's the solution:

 

ComboBox Items property =
Distinct(SortByColumns(Filter('bpn.ProgramSubtypes', ProgramKey = cboProgramKey_r.Selected.ProgramKey), "ProgramSubtypeName"), ProgramSubtypeName)

 

Card Update property:
LookUp('bpn.ProgramSubtypes', ProgramSubtypeName = cboProgramSubtypeKey_r.Selected.Result).ProgramSubtypeKey

 

ComboBox IsSearchable property = 

true

 

Thank you to @v-albai-msft for providing the syntax for this property:
Combo Box DefaultSelectedItems property =
{Result:LookUp('bpn.ProgramSubtypes', ProgramSubtypeKey=Parent.Default).ProgramSubtypeName}

 

View solution in original post

2 REPLIES 2
BPNJMC1
Helper I
Helper I

I finally figured it out.  Here's the solution:

 

ComboBox Items property =
Distinct(SortByColumns(Filter('bpn.ProgramSubtypes', ProgramKey = cboProgramKey_r.Selected.ProgramKey), "ProgramSubtypeName"), ProgramSubtypeName)

 

Card Update property:
LookUp('bpn.ProgramSubtypes', ProgramSubtypeName = cboProgramSubtypeKey_r.Selected.Result).ProgramSubtypeKey

 

ComboBox IsSearchable property = 

true

 

Thank you to @v-albai-msft for providing the syntax for this property:
Combo Box DefaultSelectedItems property =
{Result:LookUp('bpn.ProgramSubtypes', ProgramSubtypeKey=Parent.Default).ProgramSubtypeName}

 

View solution in original post

v-albai-msft
Community Support
Community Support

Hi @BPNJMC1 ,

Glad that I can help you. And also thanks for your sharing here😁

Best regards,

Allen

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

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

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,319)