cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JeroenH
Advocate I
Advocate I

Filtering a gallery based on a string with a multi-choice dropdown

Hi guys

 

I'm not even sure if this is possible, but here goes. 

 

I have a dataverse table which has a text column, that text column contains a string with multiple values. 

For example "a, b, c, d". Then I populate a dropdown with the distinct values of that column. 

 

Now I want to filter my gallery based on the multiple selected items. 

So if I have 3 rows; 

 

1. a, d, c

2. a, c

3. a, b, c, d

 

If I select a I want it to return all the values, if I select a, d I want it to return row 1 and 2 and so on. 

 

Is there a way to do this? 

3 REPLIES 3
PowerRanger
Resident Rockstar
Resident Rockstar

@JeroenH There is very likely a better solution and mine has one big downside but it might be sufficient for your needs:

 

    ForAll(
        GroupBy(
            Ungroup(
                ForAll(
                    ComboBox1.SelectedItems,
                    Search(
                        SampleList,
                        ThisRecord.Value,
                        "request"
                    )
                ),
                "Value"
            ),
            "ID",
            "myColumns"
        ),
        
        Last(
            FirstN(
                ThisRecord.myColumns,
                1
            )
        )
    )

 

You have to replce some values based on your setup. So you need to change SampleList with your DataSource and ComboBox1 with the name of your ComboBox. Place this formular in the Items property of your gallery.

 

Downside 1:

- This will not work on large datasets

- We will loose the ID column 😞 ..... I am working on a solution 🙂

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
PowerRanger
Resident Rockstar
Resident Rockstar

@JeroenH This will now have the ID back in the result:

    ForAll(
        GroupBy(
            Ungroup(
                ForAll(
                    ComboBox1.SelectedItems,
                    Search(
                        SampleList,
                        ThisRecord.Value,
                        "request"
                    )
                ),
                "Value"
            ),
            "ID",
            "myColumns"
        ),
        
        Patch(Last(
            FirstN(
                ThisRecord.myColumns,
                1
            )
        ),{ID:ThisRecord.ID})
    )

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.
JeroenH
Advocate I
Advocate I

My dataset consists of 20k + records so sadly this isn't an option. 

I have converted the string to a "choices" type column now but it's still not letting me filter for some reason.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

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.

<
Users online (2,899)