cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
keihimekawa
Helper II
Helper II

Dynamic Filtering for Multiple Controls

Hi everyone,

 

I have 2 List controls (List A, List B) and I need to filter the contents of List B based on items selected in List A. User can select multiple items in List A. How can I filter these multiple items to display the necessary content in List B?

 

List A:

CatA

CatB

CatC

 

List B:

ItemA - CatA

ItemB - CatB

ItemC - CatA

ItemD - CatD

 

User selects: CatA and CatB

 

Result in List B should be: ItemA, ItemC, ItemB.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@keihimekawa 
I think this is the code you will want to use in the Items property of List B

Filter(
    SharePointListB,
    Brand in ListBox_A.SelectedItems.Brand
)

 

If you get an error please share a screenshot.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

7 REPLIES 7
mdevaney
Super User III
Super User III

@keihimekawa 
Are you using the ListBox control?

 

My assumption here is the data in your list are all single line text.  The generic code is like this:

 

Filter(
    your_listb_datasource_name
    ListA.SelectedItems.Value in ItemColumnNameB
) 

 

 

But if you need more detailed instructions it will be necessary to share further information about your data populating ListA & ListB:

 

  • What datasource (SharePoint? Excel?, etc)
  • What are the column names?
  • What are the data types?

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

eka24
Super User III
Super User III

Watch this video
https://youtu.be/44j2VRbdWjk

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Hi @mdevaney . I am using a listbox control. To answer your questions:

  • What datasource (SharePoint? Excel?, etc) - Sharepoint
  • What are the column names? - Item (ListA) and Brand (ListB)
  • What are the data types? Do you mean in SP? They're all choices datatype in SP

I tried using the formula you provided but I'm not getting the ".Value" option after SelectedItems. 

Am I doing something wrong?

@keihimekawa 

Ok, to make sure I understand: do you have 2 SharePoint lists that look like this?

 

List A:

 

Item
ItemA
ItemB
ItemC
ItemD

 

 

List B:

 

Item Brand
ItemA CatA
ItemB CatB
ItemC CatA
ItemD CatD

 

@mdevaneymy apologies. it should be the other way around. ListA would be the Brands and ListB would be the Items

 

List A - user will select from this first. Multi-selection allowed.

Brand
CatA
CatB
CatC
CatD

 

List B:

ItemBrand
ItemACatA
ItemBCatB
ItemCCatA
ItemDCatD

 

Sorry I'm a bit all over the place. I've been trying to work this out for the whole day T__T

@keihimekawa 
I think this is the code you will want to use in the Items property of List B

Filter(
    SharePointListB,
    Brand in ListBox_A.SelectedItems.Brand
)

 

If you get an error please share a screenshot.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Alright. I feel idiotic now. Of course that made sense! Thanks for pointing this out. I finally got it to work. Now a few more list boxes T_T I have around 8 listboxes with dependencies.

 

Sorry, since I'm already here. Do you have any idea on the maximum number of items displayed in a listbox? We have a list with 2K records and I just noticed not all items are being displayed (which makes sense).

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 Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (77,709)