cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Brian_
Advocate IV
Advocate IV

Convert combo box selected items into a string

I'm trying to send the selected items in a combo box to a string for output. I know I can out individual selected items several different ways but I can't figure out how to convert all of them into one contiuous string.

I can show the first;

First(ComboBox1.SelectedItems).Title

Or the last;

Last(ComboBox1.SelectedItems).Title

And I can find the number of selected items;

CountA(ComboBox1.SelectedItems.Title)

But how do I get the first last and everything in between?

18 REPLIES 18

Please explane how this is used?

To strip off the trailing comma: not the most elegant solution but it does the job

 

Left(Concat(ComboBox1.SelectedItems, Value & ","),Len(Concat(ComboBox1.SelectedItems, Value & ","))-1)

WillPage
Impactful Individual
Impactful Individual

@csegoviaIt works pretty well. I wouldn't call it inelegant, when you consider the sort of monstrosities that can come out of the expression builder in Flow.

For those of you using an external source for your combo box items, I'd like to amend csegovia's formula to:

 

 

Left(Concat(YourComboBox.SelectedItems,Result&", "),Len(Concat(YourComboBox.SelectedItems,Result&", "))-2)

 

 

 

Perfect, thank you!

@cweaver Could you please tell me how you would add Left and Len into this formula.  I have not been able to resolve it so I can remove the trailing comma.  Thank you.  

Concat(cmbxEventSponsoringChapter.SelectedItems,(Concatenate(Acronymn,", ")))

CindyZ
Post Patron
Post Patron

This is what I resolved this with. 
Left(Concat(cmbxEventSponsoringChapter.SelectedItems,(Concatenate(Acronymn,", "))),Len(Concat(cmbxEventSponsoringChapter.SelectedItems,(Concatenate(Acronymn,", "))))-2)

SSISJoost
Frequent Visitor

Here is some example code for combobox items. List of ID's separated with a comma: 

Concat(
    ComboBox_multiselect.SelectedItems.ProductKey,
    Concatenate(
        Text(ProductKey),
        ","
    )
)

 and to get rit of the last (unwanted) comma:

Left(
    Concat(
        ComboBox_multiselect.SelectedItems.ProductKey,
        Concatenate(
            Text(ProductKey),
            ","
        )
    ),
    Len(
        Concat(
            ComboBox_multiselect.SelectedItems.ProductKey,
            Concatenate(
                Text(ProductKey),
                ","
            )
        )
    ) - 1
)

This results in a list of the ID's of the selected combo items, for example in a label:

PowerAppsCombo01

Sorry already solved above

You just need to take he last 2 characters off the string:

Left( Concat(ComboBox.SelectedItems, Product & ", " ), Len( Concat(ComboBox.SelectedItems, Product & ", " ) ) - 2 )

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

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (12,378)