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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populate multi select ...
Power Apps
Answered

Populate multi select combobox with comma delim str from SP - then submit change back to SP

(2) ShareShare
ReportReport
Posted on by 212
I have a multi select combobox (classic) which allows me to submit and retrieve multiple selections of strings. Here are the Properties of the combo box:
DefaultSelectedItems: Split(varEventLocation, ",")
Items: Sites
 
The app has a gallery which the user clicks an edit button to retrieve all the data from SP. The Edit button populates the combo box like this:
Reset(cmbNewFormLocation); //First blank the variable and reset the control
Set(
    varEventLocation,
    Blank()
);
Set( //Then get the item and store it in a variable (varSelectedSubmission)
    varSelectedSubmission,
    ThisItem
);
// Get the object for further manipulation and data extraction later: 
Set(
    varSelectedSubmissionID,
    varSelectedSubmission.ID
);
With
    {
        wSubmission: LookUp(
            CPDEventSessions,
            ID = varSelectedSubmissionID
        )
    },
  Set// Store the retrieved comma delimited string into the variable:
        varEventLocation,
        wSubmission.EventLocation
    );
 
The problem is that if the user retrieves an existing SP list item, goes into the form and then changes the selections in the combo box, then clicks a Save to SharePoint button, it doesn't save the updated combo box.
Here is the Save formula on the Save to SharePoint button:
 
   // If varItemID is not blank, update the existing item
    Patch(
        CPDEventSessions,
        LookUp(
            CPDEventSessions,
            ID = varItemID
        ),
        {
  EventLocation: If(
                !IsBlank(varEventLocation), //This If is an attempt at submitting the variable if not blank, otherwise submit the control values (cmbNewFormLocation). Doesn't work.
                varEventLocation,
                Left(
                    Concat(
                        cmbNewFormLocation.SelectedItems,
                        Title & ","
                    ),
                    Len(
                        Concat(
                            cmbNewFormLocation.SelectedItems,
                            Title & ","
                        )
                    ) - 1
                )
            ),
} etc..
Things I've tried:
  • Updating the variable in the OnChange property of the combo box: Set(varEventLocation, varEventLocation) (!?) - doesn't work, causes loops and unintended consequences!
 
Categories:
I have the same question (0)
  • Verified answer
    Ravi-Prajapati Profile Picture
    416 Super User 2025 Season 2 on at

    Step 1: Ensure varEventLocation Updates Dynamically

    Right now, varEventLocation is only being set when loading the form. It does not capture changes when users select/deselect items. To fix this, update the OnChange property of the ComboBox:

     
    powerapps
    Set(
    varEventLocation,
    Concat(
    cmbNewFormLocation.SelectedItems,
    Title & ","
    )
    )

    ✅ This ensures varEventLocation always reflects the latest selections.


    Step 2: Modify the Save (Patch()) Formula

    Your Patch() function is trying to save either varEventLocation or the ComboBox selection, but varEventLocation may not be up-to-date. Instead, modify it like this:

     
    powerapps
    Patch(
    CPDEventSessions,
    LookUp(CPDEventSessions, ID = varItemID),
    {
    EventLocation: Left(
    Concat(
    cmbNewFormLocation.SelectedItems,
    Title & ","
    ),
    Len(Concat(cmbNewFormLocation.SelectedItems, Title & ",")) - 1
    )
    }
    );

    ✅ This directly uses cmbNewFormLocation.SelectedItems instead of varEventLocation.
    ✅ The Left(..., Len(...)-1) part removes the trailing comma from the final string.


    Step 3: Remove varEventLocation from Form Population

    Since we are now handling selections directly from the ComboBox, we no longer need to store selections in varEventLocation. Instead, update the DefaultSelectedItems property of cmbNewFormLocation:

     
    powerapps
    Split(ThisItem.EventLocation, ",")

    ✅ This means selections are taken directly from SharePoint, avoiding unnecessary variables.


    Final Solution Summary

    ✔ OnChange of ComboBox:

     
    powerapps
    Set(
    varEventLocation,
    Concat(
    cmbNewFormLocation.SelectedItems,
    Title & ","
    )
    )

    ✔ DefaultSelectedItems of ComboBox:

     
    powerapps
    Split(ThisItem.EventLocation, ",")

    ✔ Save Button (Patch())

     
    powerapps
    Patch(
    CPDEventSessions,
    LookUp(CPDEventSessions, ID = varItemID),
    {
    EventLocation: Left(
    Concat(
    cmbNewFormLocation.SelectedItems,
    Title & ","
    ),
    Len(Concat(cmbNewFormLocation.SelectedItems, Title & ",")) - 1
    )
    }
    );
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,362 Super User 2025 Season 2 on at
    HI
     
    I am not following why you have all these variables?
     
    I don't mean I need to understand how they work, I am trying to understand why you have them. They click the Gallery Item and then what? Do they stay on the same screen and a form populates or is it another screen?
     
    What is the exact Column type in the back end for this multi-select situation? Choice? String? LookUp?
     
    Happy to help you solve, but I assume you are NOT usinhg Submit for a specific reason, just not sure why
     
    Thanks!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard