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

Multiple Combo Boxes, different combinations of SelectedItems in one Collection

Hello Community,

 

I'm a beginner with Power Apps and this seems a pretty complex case for me. I need your valuable help with some inputs before I venture into the rabbit hole of For All and Split with Collect. 

 

Basically, I have some ComboBoxes with multiple selected items when that case may apply. This implies that we can have some sort of combinations between the columns values. And I want to have all the combinations in a collection that will ultimately be Patched to a SharePoint, I guess. 

 

 

 

Example of selections:

AccessSelect (single selection)AccessTypeToolMail
Select AType A; Type BTool 1; Tool 2Mail 1; Mail 2

 

 

Example of how the collection should look like:

AccessSelectAccessTypeToolMail
Select AType ATool 1Mail 1
Select AType ATool 2Mail 1
Select AType BTool 1Mail 1
Select AType BTool 2Mail 1
Select AType ATool 1Mail 2
Select AType ATool 2Mail 2
Select AType BTool 1Mail 2
Select AType BTool 2Mail 2

 

 

Many Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yujincui-msft
Community Support
Community Support

Hi @IveGotThePowa ,

 

Do you want to get all combinations of multiple Combo Box selected items?

I have made a test for your reference.

Try to use the following formula:

Clear(var_combine);
ForAll(
    ComboBox1.SelectedItems As c1,
    ForAll(
        ComboBox2.SelectedItems As c2,
        ForAll(
            ComboBox3.SelectedItems As c3,
            ForAll(
                ComboBox4.SelectedItems As c4,
                Collect(
                    var_combine,
                    {
                        AccessSelect: c1.Value,
                        AccessType: c2.Value,
                        Tool: c3.Value,
                        Mail: c4.Value
                    }
                )
            )
        )
    )
)

Result Screenshots:

vyujincuimsft_2-1646277545308.png

vyujincuimsft_3-1646277574268.png

 

Best Regards,

Charlie Choi

View solution in original post

3 REPLIES 3
David_G
Helper I
Helper I

Hi,

 

Maybe could you try something like that.

 

Try to use a collection that you will Collect whenever the structure of the different elements is not in it.

 

Example :

You had only check "Select A" : { AccessSelect : "Select A", AccessType: "", Tool : "", Mail : ""}

Next you select "Type A", so you check if an element in your collection had already "Select A" in and no AccessType. If yes you update your element with "Type A" to get : { AccessSelect : "Select A", AccessType: "TypeA", Tool : "", Mail : ""}, if no, you Collect a new element.

 

I'm not sure if that is understandable but I hope that will help you.

 

v-yujincui-msft
Community Support
Community Support

Hi @IveGotThePowa ,

 

Do you want to get all combinations of multiple Combo Box selected items?

I have made a test for your reference.

Try to use the following formula:

Clear(var_combine);
ForAll(
    ComboBox1.SelectedItems As c1,
    ForAll(
        ComboBox2.SelectedItems As c2,
        ForAll(
            ComboBox3.SelectedItems As c3,
            ForAll(
                ComboBox4.SelectedItems As c4,
                Collect(
                    var_combine,
                    {
                        AccessSelect: c1.Value,
                        AccessType: c2.Value,
                        Tool: c3.Value,
                        Mail: c4.Value
                    }
                )
            )
        )
    )
)

Result Screenshots:

vyujincuimsft_2-1646277545308.png

vyujincuimsft_3-1646277574268.png

 

Best Regards,

Charlie Choi

Hi Charlie,

 

Yes, you were correct. I do want to get all the combinations, and as far as can I see your suggestion works. 

 

Thank you!

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,357)