web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / concatinating selected...
Power Apps
Answered

concatinating selected items from multiple combobox

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Guys,

 

I have 5 comboboxes.

 

each combobox is set to select multiple items. now to concat selected items from individual combox items i am using below formula in a label.

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

 

once this done i am using concatenate to bring together strings from all the labels to get a single line of string. below is the formul i am using

Concatenate(Label53_7.Text,",",Label53_6.Text,",",Label53_5.Text,",",Label53_4.Text,",",Label53_3.Text,",",Label53_2.Text,",",Label53_1.Text,",",Label53.Text)

 

But the problem is it is not mandatory for users to select from all the comboboxes and typically they might select from 2 or 3, in such cases the concatenated sting looks as below.

"Xyz,,,,abc"

 

i want to get rid of additional commas. any solution for this?

Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    You can achieve your goal without the CONCATENATE function by using this code in the Text  property of your label.

    If(!IsBlank(Label53_7),Label53_7.Text,",")&
    If(!IsBlank(Label53_6),Label53_6.Text,",")&
    If(!IsBlank(Label53_5),Label53_5.Text,",")&
    If(!IsBlank(Label53_4),Label53_4.Text,",")&
    If(!IsBlank(Label53_3),Label53_3.Text,",")&
    If(!IsBlank(Label53_2),Label53_2.Text,",")&
    If(!IsBlank(Label53_1),Label53_1.Text,",")&
    If(!IsBlank(Label53),Label53.Text,",")

     

    If you must get rid of the trailing comma at the end of the last value then you'll need this code instead.

    Left(
     If(!IsBlank(Label53_7),Label53_7.Text,",")&
     If(!IsBlank(Label53_6),Label53_6.Text,",")&
     If(!IsBlank(Label53_5),Label53_5.Text,",")&
     If(!IsBlank(Label53_4),Label53_4.Text,",")&
     If(!IsBlank(Label53_3),Label53_3.Text,",")&
     If(!IsBlank(Label53_2),Label53_2.Text,",")&
     If(!IsBlank(Label53_1),Label53_1.Text,",")&
     If(!IsBlank(Label53),Label53.Text,","),
     Len(
     If(!IsBlank(Label53_7),Label53_7.Text,",")&
     If(!IsBlank(Label53_6),Label53_6.Text,",")&
     If(!IsBlank(Label53_5),Label53_5.Text,",")&
     If(!IsBlank(Label53_4),Label53_4.Text,",")&
     If(!IsBlank(Label53_3),Label53_3.Text,",")&
     If(!IsBlank(Label53_2),Label53_2.Text,",")&
     If(!IsBlank(Label53_1),Label53_1.Text,",")&
     If(!IsBlank(Label53),Label53.Text,",")
     )-1
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I got a similar answer to @mdevaney. It's ugly, so I'm glad me and him got similar results!

     

    Replace(Concatenate
    (
    If(IsBlank(Label53_7.Text),"",Label53_7.Text & ","),
    If(IsBlank(Label53_6.Text),"",Label53_6.Text & ","),
    If(IsBlank(Label53_5.Text),"",Label53_5.Text & ","),
    If(IsBlank(Label53_4.Text),"",Label53_4.Text & ","),
    If(IsBlank(Label53_3.Text),"",Label53_3.Text & ","),
    If(IsBlank(Label53_2.Text),"",Label53_2.Text & ","),
    If(IsBlank(Label53_1.Text),"",Label53_1.Text & ","),
    If(IsBlank(Label53.Text),"",Label53.Text & ",")
    ),
    Len(Concatenate(
    If(IsBlank(Label53_7.Text),"",Label53_7.Text & ","),
    If(IsBlank(Label53_6.Text),"",Label53_6.Text & ","),
    If(IsBlank(Label53_5.Text),"",Label53_5.Text & ","),
    If(IsBlank(Label53_4.Text),"",Label53_4.Text & ","),
    If(IsBlank(Label53_3.Text),"",Label53_3.Text & ","),
    If(IsBlank(Label53_2.Text),"",Label53_2.Text & ","),
    If(IsBlank(Label53_1.Text),"",Label53_1.Text & ","),
    If(IsBlank(Label53.Text),"",Label53.Text & ",")
    ))
    ,1
    ,"")

     

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    Well you know @Anonymous didn't say he needed the solution to be pretty... LOL 🤣

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks much guys... was very helpful

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I spent some time looking into making this a little less ugly and easier to maintain and came across the With() function, which I was not familiar with. I shortened the formula to the one below using your neater version of the join. Figured I'd pass the info along in case you weren't familiar with it either.

    With({joinedString:
    If(!IsBlank(Label53_7),Label53_7.Text&",")&
    If(!IsBlank(Label53_6),Label53_6.Text&",")&
    If(!IsBlank(Label53_5),Label53_5.Text&",")&
    If(!IsBlank(Label53_4),Label53_4.Text&",")&
    If(!IsBlank(Label53_3),Label53_3.Text&",")&
    If(!IsBlank(Label53_2),Label53_2.Text&",")&
    If(!IsBlank(Label53_1),Label53_1.Text&",")&
    If(!IsBlank(Label53),Label53.Text,",")},
    Left(joinedString,Len(joinedString)-1))

     Here's the doc:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-with

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 177

Last 30 days Overall leaderboard