cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndyVM
Regular Visitor

Populate ComboBox Choices from two SharePoint List Columns

I would like to populate a Combobox choice options with DISTINCT values from two Text Value columns in the same SP list and sort them as shown below.

 

ColumnAColumnB
3-CCC1-AAA
3-CCC5-EEE
4-DDD3-CCC
2-BBB4-DDD
3-CCC5-EEE
10-JJJ11-KKK

 

ComboBox Choices

1-AAA

2-BBB

3-CCC

4-DDD

5-EEE

10-JJJ

11-KKK

 

I figured out how to get the items from one column but have not been able to figure out how to add the second column data.


Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @AndyVM,

Do you want to get distinct values from both of Text columns and populate the Combo Box with that distinct values?

Could you please share a bit more about your scenario?

 

I think you could directly collect them into a collection as below:

 

ClearCollect(
    colOPtions,
    RenameColumns(
        Distinct(
            Options,
            ColumnA
        ),
        "Result",
        "Choices"
    )
);
ForAll(
    Distinct(
        Options,
        ColumnB
    ),
    Patch(
        colOPtions,
        Defaults(colOPtions),
        {Choices: Result}
    )
)

 

Options is my data source.

Then you could set the Items of the Combo Box as below:

 

Distinct(colOPtions,Choices)

 

Best Regards,
Qi

View solution in original post

2 REPLIES 2
SudeepGhatakNZ
Resident Rockstar
Resident Rockstar

Create a collection like this

ClearCollect(MyColl,Choices([@YourList].YourColumn1),Choices([@YourList].YourColumn2))

Set this collection as a data source for your dropdown. You can sanitize the data using Distinct, Sort, etc.

If my suggestion helped you, please give it a Thumbs up and mark it as a Solution so that it can benefit others in the community.
v-qiaqi-msft
Community Support
Community Support

Hi @AndyVM,

Do you want to get distinct values from both of Text columns and populate the Combo Box with that distinct values?

Could you please share a bit more about your scenario?

 

I think you could directly collect them into a collection as below:

 

ClearCollect(
    colOPtions,
    RenameColumns(
        Distinct(
            Options,
            ColumnA
        ),
        "Result",
        "Choices"
    )
);
ForAll(
    Distinct(
        Options,
        ColumnB
    ),
    Patch(
        colOPtions,
        Defaults(colOPtions),
        {Choices: Result}
    )
)

 

Options is my data source.

Then you could set the Items of the Combo Box as below:

 

Distinct(colOPtions,Choices)

 

Best Regards,
Qi

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,250)