cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jrasal
Frequent Visitor

Searching a comma seperated SP list with Combobox to filter a gallery.

Hi there,

 

I've got a very specific request that a simple google search isn't solving for me so thought I'd throw it out to everyone here.

 

I have a gallery connected to a SP list (Test Science Conference) that I wish for users to fitler using multiple comboboxes. There are two areas the list can be filtered by: Location and Topic. A record can be tagged with more than one topic and this is where my problem is.

 

In the SP list the topics are in the same column, if the record covers multiple topics they are entered into the same cell and seperated by a comma. The code I'm using won't include a record in a topic search if there is more than one topic. My question is: is there a way to tell the search that the SP list topic column has multiple values seperated by a comma? Right now my code is working if there is only one topic entered in the record but there will be multiple topics for most records.

 

These are the requirements for the search:

- when the comboboxes are empty the gallery should show all the records

- when both comboboxes are used the only records returned should fulfill both requirements

- the comboboxes maybe used in any order

- when the selection is deleted from the comboboxes that filter should be removed from the gallery

 

Here is the code I'm using:

 

If(
    !IsEmpty(ComboBox1.SelectedItems) && !IsEmpty(ComboBox2.SelectedItems),
    Filter(
        'Test Science Conference',
        Location in ComboBox1.SelectedItems,
        Topics in ComboBox2.SelectedItems
    ),
    IsEmpty(ComboBox1.SelectedItems) && IsEmpty(ComboBox2.SelectedItems),//if both combobox are empty, return all records
    'Test Science Conference',
    Filter(
        'Test Science Conference',
        (Location in ComboBox1.SelectedItems) || (Topics in ComboBox2.SelectedItems)
    )
)

 

Still very new to PowerApps and coding so any help or pointers would be very much appricated. Let me know if you need any more information about how to solve this.

 

Thanks,

 

Jrasal

1 ACCEPTED SOLUTION

Accepted Solutions
Jrasal
Frequent Visitor

I doubt it's polite to answer your own question but I've solved my own query. I changed my SP list columns to 'choice' fields instead of single text lines (one single choice, one with check boxes). I then updated my code to reflect the changes, I'm posting it here in case anyone wants to use it:

 

Data Source: Testing Science Conference
Column names: Topics, Country

 

 

If(!IsEmpty(ComboBox1.SelectedItems)&&!IsEmpty(ComboBox2.SelectedItems),

Filter('Testing Science Conference', ComboBox2.Selected.Value in Topics.Value,Country.Value=ComboBox1.Selected.Value),

IsBlank(ComboBox1.Selected)&&IsBlank(ComboBox2.Selected),

'Testing Science Conference',

Filter('Testing Science Conference',(Country.Value=ComboBox1.Selected.Value)||(ComboBox2.Selected.Value in Topics.Value)))

 

 

This code allows 2 Comboboxes to be used to filter a gallery, and for one Combobox to select just one 'phrase'/'tag' and a record with multiple tags attached to it to be filtered into the list.

View solution in original post

1 REPLY 1
Jrasal
Frequent Visitor

I doubt it's polite to answer your own question but I've solved my own query. I changed my SP list columns to 'choice' fields instead of single text lines (one single choice, one with check boxes). I then updated my code to reflect the changes, I'm posting it here in case anyone wants to use it:

 

Data Source: Testing Science Conference
Column names: Topics, Country

 

 

If(!IsEmpty(ComboBox1.SelectedItems)&&!IsEmpty(ComboBox2.SelectedItems),

Filter('Testing Science Conference', ComboBox2.Selected.Value in Topics.Value,Country.Value=ComboBox1.Selected.Value),

IsBlank(ComboBox1.Selected)&&IsBlank(ComboBox2.Selected),

'Testing Science Conference',

Filter('Testing Science Conference',(Country.Value=ComboBox1.Selected.Value)||(ComboBox2.Selected.Value in Topics.Value)))

 

 

This code allows 2 Comboboxes to be used to filter a gallery, and for one Combobox to select just one 'phrase'/'tag' and a record with multiple tags attached to it to be filtered into the list.

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.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

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.

Top Solution Authors
Users online (3,690)