Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Patching Combo Box Selected Items Not Working

(1) ShareShare
ReportReport
Posted on by 39
I have a multi-select combo box called "CB17" within a data card/within a form.  Outside the form is a button with a patch function to take the selected CB17 items and patch to a SP list called "Audit Main".  If CB17 Items is set to:    Choices([@Audit_Main].Address), CB17.SelectedItems,Value     then the patch works. However, users cannot search the CB17 combo box for any key word, meaning search only works in order. For example, user wants to find 123 State Street but can only find if typing 123 and not State or Street. So, I changed the CB17 Items to:    Distinct(Sort(Audit_Main, Address, SortOrder.Ascending), Address)    , which solves the search issue but then patch is unhappy. Patch error says expecting table value but of a different schema.
 
I've tried several patch variations, but nothing works. I've also inserted a second combo box and set its default selected items to CB17 and tried to run the patch using the second combo box (CB17_2), which gives no errors, but no data is passed.
 
In the end, CB17 needs to search strings across available choices and/or patching needs to be set differently to work. Or CB17 Items needs to be changed.  
 
Here's what I've tried for patch:
 
Patch(
        Audit_Main,
        Defaults(Audit_Main),
        {
            'File Name': TI_AuditName.Text,
             BE: CB17.SelectedItems  (Also tried BE: {Id: CB17.Selected.Id, Value: CB17.Selected.Value}
)
Categories:
  • PowerAutomatic Profile Picture
    PowerAutomatic 39 on at
    Patching Combo Box Selected Items Not Working
    Warren, TYSM! I would have never gotten that on my own. Ur definitely right on complexity. Wish I would have started off with your suggestion of text. 
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Patching Combo Box Selected Items Not Working
    I am still not completely clear on the list and file names, but I will run with the assumption that you are writing back from multi-select combo box CB17 with the Items
    Distinct(
       Sort(
          Audit_Main, 
          Address, 
          SortOrder.Ascending
       ), 
       Address
    )
    to a multi-value lookup field BE. I also have to assume that the BE field is looking up the Main list field also called Address, in which case the Patch would be
    Patch(
       Audit_Main,
       Defaults(Audit_Main),
       {
          'File Name': TI_AuditName.Text,
           BE:
           ForAll(
              CB17.SelectedItems As _Data,
             {
                Value: _Data.Value,
                Id: 
                LookUp(
                   Audit,
                   Address = _Data.Value
                ).ID
             }
          )
      } )
    I will add a further comment that SharePoint Lookup columns are mostly unnecessary with Power Apps and have the potential to cause you unwanted and unneeded complexity and restrictions - I have never used them. It is generally a better idea to get the required field Items directly from the second list with Power Apps and write back to a Text column.
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • PowerAutomatic Profile Picture
    PowerAutomatic 39 on at
    Patching Combo Box Selected Items Not Working
    Hi Warren, 
     
    BE is a lookup and address is dependent on BE. BE is a lookup to another list called Main. When setting up the "Audit Main" list, I set BE to lookup the "Main" list but then address as an additional column. When BE is selected, it automatically fills in address.   
  • WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Patching Combo Box Selected Items Not Working
    Hi @PowerAutomatic​​​​​​​
    The information you have not included is the field type of BE. Also what type of field (Lookup or Choice) is Address ?

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,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard