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}

 

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,354)