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 / Patch multi select com...
Power Apps
Answered

Patch multi select combobox as choice column

(1) ShareShare
ReportReport
Posted on by 39
Hello all
 
I hope you're all doing well
 
I am having an issue with a combobox in my power app
 
Details
Datacardvalue1 is a combo box fed by the choice column called "Hub" in my SharePoint list. I have not enabled the option in "Display choices using:" called "Checkboxes (allow multiple selections)". Or actually I did but it then created a big problem for my form so I had to stop and go back to the option "Drop Down Menu".
In power apps I have enabled multi selection
 
When i make a choice involving more than one selection, only one value gets transmitted to the SP list. 
 
I have tried Var & Collections to retain the choices made and then to patch them but none of it would work as I would always get the same problem with the formula in the "On select" property of my submit button. It would say "The type of this argument does not match the expected type 'Record'. Found type 'text'" (or 'table' depending on what I tried).
 
I read a post that was marked as solved (https://community.powerplatform.com/forums/thread/details/?threadid=f1dcd2c1-b78b-4f8d-b7de-e9ac47fe0233) and the formula was very close from what I attempted but even then it is telling me again the type of this argument....
 
I tried this in the On Select property of the button
Patch(
    'Main Table',
    LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
    {Hub: DataCardValue1.SelectedItems}
);
 
Not sure what I can do.

If you need more information let me know
 
Vincent
Categories:
I have the same question (0)
  • Suggested answer
    Nandit Profile Picture
    1,568 Moderator on at
     
    What is the Items property of your Combo Box or hardcoded? Can you confirm you have the following properties in your solution - 
     
    Combo Box Items:
    Choices([@SPList].Hub)
    And in your Patch statement (which looks correct):
    {Hub: DataCardValue1.SelectedItems}
    Let me know if changing the Items property helped.
     
    Kind regards, 
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
     
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Hey, 
     
    If I understand it correctly your setup it can't work the way you try it. 
    Since you have "Checkboxes (allow multiple selections)" turned of it will always just save at max 1 Record. 
    To have multiple records (a table) being saved you have to allow multiple selections in Sharepoint. Power apps can't overrule the settings from your Datasource. 
     
    So rather then working on your app I would consider working on the Sharepoint list to resolve the problem that you mentioned. 
     
    Can you tell us what this big problem was that you've had?
     
    If this solved your problem please accept this answer as solution so others can find it as well.
     
    If it helped in any other way please consider giving it a like so we can keep supporting each other. 
  • VA-31070842-0 Profile Picture
    39 on at
    Hello Nandit,

    Thanks for the quick answer.
     
    I have this in the item property of the combobox : 
    Choices([@'Main Table'].HUB)
     
    And this for the patch function in the on select property of the submit button
    Patch(
        'Main Table',
        LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
        {Hub: DataCardValue1.SelectedItems}
    );
    But it says for "{Hub: DataCardValue1.SelectedItems}" The type of this argument 'HUB' does not match the expected type 'Record'. Type found 'Table'
     
    Thanks

    Vincent
  • VA-31070842-0 Profile Picture
    39 on at
    Hi DBO_DV
     
    Thanks for your feedback
     
    The problem I had when I had enable multi selection in the SP was that it stopped the form from being submitted and would give an error such as "network error when using patch function".
    I had then removed the field Hub from the form in power apps, refreshed the connector/SP list in power apps and added the field again. All seemed well and I could indeed submit more than one but after one try it then gave me this error.

    Thx
     
    Vincent
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Hey Vincent,  
     
    if you are using a Form, the easiest way to save data is to use SubmitForm instead of Patch.
    However if you absolutely want to save it with patch thats no problem. 
    Could you just recreate the Formula and post it here. Espeacially the part with the combobox. 
     
    If this solved your problem please accept this answer as solution so others can find it as well.
     
    If it helped in any other way please consider giving it a like so we can keep supporting each other. 
  • VA-31070842-0 Profile Picture
    39 on at
    Hey DBO_DV 
     
    I do have submit form 
     
    This is my entire On Select Property 
    SubmitForm(FraudForm);
    // Submits the form 'FraudForm' to its data source. This sends the data entered in the form to the connected SharePoint list (Main table).
     
    If(
        CountRows(CBCountryText.SelectedItems) = 0,
        // Check if the ComboBox 'CBCountryText' has no selected items. If no country is selected, then:
        Patch(
            'Main Table',
            // 'Main Table' is the name of the data source (SharePoint list).
            LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
            // Use the LookUp function to find the record in 'Main Table' where the ID matches the ID of the last submitted item in 'FraudForm'.
            {Countrytext: varOriginalCountry}
            // Update the 'Countrytext' field with the value stored in the variable 'varOriginalCountry' (Visible property of the screen : Set(varOriginalCountry,Gallery1.Selected.Countrytext)
        )
    );
     
    If(
        CountRows(CBHotelCode_1.SelectedItems) = 0,
        // Check if the ComboBox 'CBHotelCode_1' has no selected items. If no hotel code is selected, then:
        Patch(
            'Main Table',
            // 'Main Table' is the data source that you're updating.
            LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
            // Use LookUp to find the record in 'Main Table' where the ID matches the last submitted form ID.
            {'Hotel code': varOriginalHotelCode}
            // Update the 'Hotel code' field with the value stored in the variable 'varOriginalHotelCode' (Visible property of the screen : Set(varOriginalHotelCode,Gallery1.Selected.'Hotel code')
        )
    );
     
     
    The patch function was just to try and find a way around the problem when not having enabled the multi select in SP
     
    Sorry if I wasn't clear enough earlier
     
    Vincent
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Are both Patches not working? 

    Are the Comboboxes Country and Hotel both in your Form aswell? 

    If both comboboxes have a value in them is the formula working as expected? 
     
    Is Hotel Code and Country text the Choice fields from SharePoint? 
     
    Are the variables choices that you could select? 

    Sorry for all those questions, but that will help me give the most appropriate solution since i think we can make this a whole lot easier. 
     
  • VA-31070842-0 Profile Picture
    39 on at
    Hi DBO_DV
     
    No apology needed, I appreciate the help
     
    Are both Patches not working?  those patches are working (Country and Hotelcode)

    Are the Comboboxes Country and Hotel both in your Form aswell?  Yes they are but those are made differently. There is a textbox fed by single line columns in the SP and we created a combo box to allow the selection of countries and hotel codes. After selecting, it gets copied to the textboxes. 

    If both comboboxes have a value in them is the formula working as expected?  Yes all working fine
     
    Is Hotel Code and Country text the Choice fields from SharePoint?  Yes
     
    Are the variables choices that you could select? The variables are there to keep the original selection you can see in the SP in case no changes are made in edit mode.
     
    Basically my formula is working all fine for all I need.

    I just recently spotted that for my Hub, only one would get transmitted to the SP. So I started to find different ways to make it work. 
    - Enabled the multi selection in SP but it created the issue I mentioned earlier
    - Tried a collection or variable to store the selected hubs and then patch them (along with the other patch functions). But my patch function for the Hub specifically is not working and returns an error no matter what.
     
    So it's really on the Hub. Everything else works as expected.
     
    Ta
     
    Vincent
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Okay I was a bit confused because I couldn't find The Hub in the Formula.

    I thought maybe it is a Placeholder for something else. 
     
    Can you confirm that the Items from DatacardValue1 are 
    Choices([@'Main Table'].Hub)
    If this is correct could you try to try this version of Patch once: 
    Patch(
        'Main Table',
        LookUp('Main Table', ID = FraudForm.LastSubmit.ID),
        {Hub: First(DataCardValue1.SelectedItems)}
    );
    This will only save the first selection to Sharepoint. 
     
    But it will give us some valuable information. 
    Can you also make sure to send the error message if there is one. 
     
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Hey, just wanted to check-in to see if your problm is solved? 

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