Power Community

Power Community

Many on many filters from Multi-choice combo box

image

A question raised many times is filtering a gallery from a multi-choice combo box on a multi-choice field. This is a many-to-many filter. Depending on the data source, this may not be Delegable as the in operator is necessary, and also ForAll and Ungroup have lesser but existing limitations.
A gallery can be presented with a single filter searching for any item selected in the Combo Box existing in any of the values contained in the multi-choice field in the data source.
To do this, the ForAll() operator is needed to create a Table filtering the data source field for each of the selected values. This process results in a series of records that are themselves Tables with a single field Value, so Ungroup() is used to resolve the final list.
Also, allowance has been made for no entry in the Combo Box.

If(
   Len(ComboBoxName.Selected.Value) = 0,
   DataSource,
   Ungroup(
      ForAll(
         ComboBoxName.SelectedItems As aSel,
         Filter(
            DataSource,
            aSel.Value in MultiChoiceField.Value
         )
      ),
      "Value"
   )
)

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Enable Early Access Wave 1 2023 | Power Platform

Like every 6 months, enabling Early Access is one of the best things to look forward to as Microsoft...

More Articles Like This

- Advertisement -spot_img