cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Checkbox connected to Multi Selection drop-down

I have a multi selection dropdown (Location) connected to Sharepoint with 3 choices ("North America","Europe","Asia-Pacific"). In my powerapps form, i want to have a 'Select All' checkbox which if checked, it will select all 3 values in the dropdown. How could i do this? I have run out of options. Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Is the Location field a Chioce type column in your SP List?

Do you enable "Allow Multiple selections" option for the Location field in your SP list?

Further, do you want to select all option values within the Location ComboBox when you check the checkbox?

 

I assume that the Location field is Choice type column in your SP List, and you have enabled "Allow Multiple selections" option for it. I have made a test on my side, please take a try with the following workaround:1.JPG

Add a Checkbox within the Location Data card, set the OnSelect property of the "Checkbox" control to following:

If(
    Checkbox1.Value,
    Set(SelectAll, true),
    Set(SelectAll, false)
)

Set the Items property of the Location ComboBox to following:

Choices('YourSPList'.Location)

Set the DefaultSelectedItems property of the Location ComboBox to following:

If(
    SelectAll,
    Table(
        {
            Value: "North America"
        },
        {
            Value: "Europe"
        },
        {
            Value: "Asia-Pacific"
        }
    ),
    Parent.Default
)

Please check the GIF screenshot for more details:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Pstork1
Dual Super User III
Dual Super User III

So here's the process that works for me.

1) set a variable called AllItems to True in the ONChecked property of the checkbox and False in the OnUnchecked.

2) set the defaultselectedItems property of the ComboBox to

If(allitems,collection,Table())

This works when the datasource is a collection, but not when using a regular datasource. What its really looking for in the defaultselectedItems is a comma delimited list of the item names.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Is the Location field a Chioce type column in your SP List?

Do you enable "Allow Multiple selections" option for the Location field in your SP list?

Further, do you want to select all option values within the Location ComboBox when you check the checkbox?

 

I assume that the Location field is Choice type column in your SP List, and you have enabled "Allow Multiple selections" option for it. I have made a test on my side, please take a try with the following workaround:1.JPG

Add a Checkbox within the Location Data card, set the OnSelect property of the "Checkbox" control to following:

If(
    Checkbox1.Value,
    Set(SelectAll, true),
    Set(SelectAll, false)
)

Set the Items property of the Location ComboBox to following:

Choices('YourSPList'.Location)

Set the DefaultSelectedItems property of the Location ComboBox to following:

If(
    SelectAll,
    Table(
        {
            Value: "North America"
        },
        {
            Value: "Europe"
        },
        {
            Value: "Asia-Pacific"
        }
    ),
    Parent.Default
)

Please check the GIF screenshot for more details:Test.gif

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Pstork1
Dual Super User III
Dual Super User III

I agree with all @v-xida-msft comments.

 

But I would suggest one change.  Rather than using an IF statement in the OnSelect just add the True and False settings for the variables to the OnCheck and OnUncheck methods respectively..  That way you don't need an IF



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Hi @Anonymous how are you progressing with this? Were the above replies helpful?

 

@Anonymous 

Anonymous
Not applicable

wow thank you guys!! Last question, how do i clear the variable? I like clearing them onhidden 

Pstork1
Dual Super User III
Dual Super User III

You can set a Variable to Blank, which will clear the value, but there is no way I know of to delete the variable entirely once you set it.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

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

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (54,535)