Select All for a Multi-select choice field in Power Apps

How do you select all items in a multi-select choice column in a SharePoint form?

For small choice fields with only two or three options this doesn’t matter too much, but if you have more than 4 options the missing select all is missing quite quickly.

Multi-Select choice columns

In SharePoint you can have multi select columns. Within these column you can tick each option but there is no select all option available. This is quite annoying isn’t it?

A multi select field in SharePoint
Select All for a Multi-select choice field in Power Apps 1

We will need to customize the form. Customizing forms is done with Power Apps by selecting the customize with power apps option from the list menu.

Customize with PowerApps
Select All for a Multi-select choice field in Power Apps 2

We now want to add a checkbox to the form so that all options can be selected as shown below.

A Select all being selected

And none of the options should be selected when the tick box is deselected!

A Select All being deselected
Select All for a Multi-select choice field in Power Apps 3

How to create the Select all?

In my form I located my Favourite Ice cream Multi-select field’s datacard, then I unlocked this field.

Unlock the control
Select All for a Multi-select choice field in Power Apps 4

You will have to unlock the field otherwise you can configure the filtering as Power Apps doesn’t allow you to set anything within the datacard control unless it is unlocked.

Added a checkbox for the Select All option
Select All for a Multi-select choice field in Power Apps 5

You might have to position the check box correctly on the form. You can place it where ever you like as long as you stay within the form.

Set Default SelectedItems to SelectedItems
Select All for a Multi-select choice field in Power Apps 6

Now I set the DataCardValue2 (this is the one of my favourite icecream field) to SelectedItems. Selected Items will be a variable that I’m about to create in the next steps.

Setting the SelectedItems Variable

The OnSelect code for the CheckBox1 control now needs to be set to the following code:

If(
    Checkbox1.Value,
    Set(
        SelectedItems,
        [
            "Vanilla",
            "Strawberry",
            "Chocolate"
        ]
    ),
    Set(
        SelectedItems,
        []
    )
)

So depending on the value of the checkbox we will either set the Selected Items to an array of flavours or we simply set it to an empty collection []

The End Result


Discover more from SharePains

Subscribe to get the latest posts sent to your email.

Related Posts

4 thoughts on “Select All for a Multi-select choice field in Power Apps

  1. Thanks for these steps! They work flawlessly on my Form, functionally speaking. Iโ€™m running into an issue though, where after my Form has been filled out, saved, and closed, when itโ€™s re-opened, there are no longer selections in my field; itโ€™s just completely wiped out. AKA if Iโ€™ve selected the checkbox previously, it re-opens as unselected, and if Iโ€™ve made single/multiple selections in my drop-down, instead of utilizing the checkbox to select all, those too disappear upon re-openingโ€ฆ Any thoughts what could be causing this? Weโ€™re trying to determine if thereโ€™s another specific code which also needs to be entered in another field to help retain the checkbox selection or the single vs. multiple drop-down selection.

    1. Your Items property should be filling in your combo box: Choices([@’YourList’].’Your Field’)
      Your DefaultSelectedItems should be: If(SharePointForm1.Mode = FormMode.New, SelectedItems, ThisItem.’Your Field’)
      ** not just SelectedItems, as was made in this post. Your field is probably empty because you’re not getting ThisItem.’YourField’ in there.
      OnChange: ClearCollect( MyCollection, ComboBox1.SelectedItems );
      and I do: Set(MyCollection, []);
      in my App’s OnStart.
      I also use this opportunity to check my collection to see if they selected certain values:
      If(CountRows(Filter(MyCollection,Value=”My Option 1″)) = 1,
      Set(SomeVariable, true), Set(SomeVariable, false)
      );

      Assuming you have 3 available options for your ComboBox, the Default of the checkbox should be: If(CountRows(MyCollection) = 3, true, false)
      This way, it will automatically fill in the checkbox as checked if they select all of the options and uncheck it if they don’t.

      OnCheck:
      Set(
      SelectedItems,
      [
      “My Option 1”,
      “My Option 2”,
      “My Option 3”
      ]
      );

      OnUncheck:
      Set(
      SelectedItems,
      []
      );
      Reset(ComboBox1);

  2. Darn. The drop-down was working and retaining selections properly, until I added in the checkbox, so I’m thinking it’s not the drop-down that’s forcing things to reset. Thank you for the quick response though!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.