Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Displaying a combo box's selected items in a label

(0) ShareShare
ReportReport
Posted on by 332

I have a combo box in my app that allows multiple selections, and I have a separate label that displays the selections from the combo box. I'm doing this because there could be many selections and I want the user to be able to see them all at a glance. It works fine when the user is choosing new items in the combo box. They show up fine in the label.

 

However, when you navigate from a gallery on another screen and the combo box is populated with default selected items, the label doesn't show anything.

 

My combo box is in a form. The Items that populate the combo box come from a collection. (The items property of the combo box is Collection.Title).

 

The defaultselecteditems property of the combo box is:

RenameColumns(Filter(Split(Parent.Default, ";"), !IsBlank(Result)), "Result", "Value")

 

The text property of my label is: Concat(ComboBox1.SelectedItems, Title& Char(13))

 

Any suggestions would be greatly appreciated. Thanks!

 

  • T_A_M Profile Picture
    T_A_M 332 on at
    Re: Displaying a combo box's selected items in a label

    Thank you very much for your help. The problem was that my column type was set to Rich Text and I didn't realize it!

  • EddieE Profile Picture
    EddieE 4,641 on at
    Re: Displaying a combo box's selected items in a label

    @T_A_M 

    Your code works fine in my sample on a MultiLine of Text column using 'Plain Text'. Check for errant code snippets eg a comma or ')' somewhere. Is there some other code in this Text property that you are also trying to apply eg an If() statement?

     

    I'd just clear out all the code in this property then copy and paste your code back in to see if that works

     

    EDIT: I meant to ask, are you using Plain text or Rich/Enhanced text on your column. Plain text causes the least amount of issues in PowerApps. The other two can be quite difficult to work with

  • T_A_M Profile Picture
    T_A_M 332 on at
    Re: Displaying a combo box's selected items in a label

    The Audit_sample column type is "multiple lines of text" where the values are separated by ";" and Char(13).

  • EddieE Profile Picture
    EddieE 4,641 on at
    Re: Displaying a combo box's selected items in a label

    @T_A_M 

    What column type is Audit_sample? I assumed it is a Single Line of Text where values are separated by ‘;’

     

  • T_A_M Profile Picture
    T_A_M 332 on at
    Re: Displaying a combo box's selected items in a label

    Thanks for your help. I'm having some trouble getting that code to work. I get an error that says the funtion "Split" has some invalid arguments:

     

    This is what I pasted into the text property of my label:

     

    Concat(
    Split(
    ThisItem.Audit_sample,
    ";"
    ),
    Result & Char(13)
    ) & Concat(
    Filter(
    ComboBox1.SelectedItems,
    !IsBlank(Title)
    ),
    Title & Char(13)
    )

     

    Audit_sample is the name of my column in Sharepoint. I also tried Title in its place, but that didn't work either..

  • Verified answer
    EddieE Profile Picture
    EddieE 4,641 on at
    Re: Displaying a combo box's selected items in a label

    @T_A_M 

    This works

    Concat(
     Split(
     ThisItem.yourColumnName,
     ";"
     ),
     Result & Char(13)
    ) & Concat(
     Filter(
     ComboBox1.SelectedItems,
     !IsBlank(Title)
     ),
     Title & Char(13)
    )

     

    However, an issue I found was if you remove any existing items displayed in your Combo Box (ie from the existing record) then these aren't removed from the label. Not sure if that's a needed function but there's probably a few ways to do this ... 

     

    I did find that your code works perfectly fine when using a Choice column and the Choices() function, it just doesn't seem to like collections for the ComboBox Items.

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard