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 / Compare SharePoint mul...
Power Apps
Unanswered

Compare SharePoint multiselect choice column with combobox selected values

(0) ShareShare
ReportReport
Posted on by 244

I cannot believe this is so difficult to do. I have a custom SharePoint list form which uses combo boxes for several multi-select choice fields in the list. I am trying to compare what is entered in the form with what is currently stored in the list. Basically, I have a button click triggered with OnChange of any field. The OnSelect formula of the button compares the value entered in the form control with the value saved in the list for all fields to determine whether or not the original submission has changed prior to submitting the form. It works perfectly with every field type EXCEPT combo boxes. I even get an error that says a Table can't be compared with a Table. WHAT??? 

 

I've tried using @WarrenBelz tutorial here:
Many to Many Filters – Practical Power Apps
But I just can't figure out how to get it to work properly. I tried this:

 

ClearCollect(colA1Values,
Ungroup(
 ForAll(
 ValueA1.SelectedItems As varSelectedA1,
 Filter(
 'PSMF Requirements',
 varSelectedA1.Value in A1.Value
 )
 ),
 "Value"
)
)

 

But that just adds two empty rows containing every column in the list to the collection. 

How can I compare what's in the SelectedItems property of the combo box "ValueA1" with the stored choices in the multiselect choice field in SharePoint???

 

Thanks in advance for any help!

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    Hi @CCJones ,

    I am not sure what you are doing with the collection at the top, or which element is which in your code, but the syntax you need to do the many to many filter is

    Ungroup(
     ForAll(
     MultiSelectComboBox.SelectedItems As varSelectedA1,
     Filter(
     DataSource,
     varSelectedA1.Value in DataSourceMultiValueField.Value
     )
     ),
     "Value"
    )

    I also assume here that the output of the Combo Box is .Value

  • CCJones Profile Picture
    244 on at

    Thanks @WarrenBelz . I am just a bit confused on how to get the data into a format where I can compare the two values (what's in the combo box with what's currently saved in the choice field). That's why I did the collection. I was thinking that's what I needed to compare to the choice field. 

     

    The elements in my formula are based on yours. ValueA1 is the combo box. PSMF Requirements is the data source (SharePoint list). A1 is the multi-select choice box. The combo box output is ".Value".

     

    Does the formula only return data if the elements match? Where would it be placed in order to return an indication that the values do or do not match? Would it be something like an "If(IsBlank(FORMULA), false, true)" type thing?

     

    Sorry for my very limited understanding of this. It's really frustrating that MS hasn't made a control that can work with all aspects of the SharePoint list choice field in a product for which one advertised use is SharePoint list form customization tool. I've been working with SharePoint for at least two decades. Never had this much trouble with any tools used to modify list forms. InfoPath, SharePoint Designer, Nintex, even Bamboo Solutions all worked well if not great. As a non-developer, I despise PowerApps. Maybe I'm just not finding the right resources. 

  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    Hi @CCJones ,

    Please post you full Filter code (in Text) including elements relate to this function.

  • CCJones Profile Picture
    244 on at

    That's just it. I don't have any code. I set mine up in a test form to see how I could get it to work but I have no idea how to implement it to do what I'm trying to do. 

     

    I had another form I created that does the same type of thing and had no combo boxes in it. That worked perfectly. Adding the multi-select combo boxes throws a wrench into the works. The OnChange of each input field has a call to a hidden button in the form using the following:

    If( 
     ThisItem.Status = "Approved", 
     Select(FormUpdateButton)
    )

     

    The FormUpdateButton code is as follows:

    If(
     Or(
     Not(ThisItem.Country = CountryValue.Text),
     Or(
     Not(ThisItem.'A' = ValueA.Value),
     Or(
     Not(ThisItem.'A1'.Value = ValueA1.SelectedItems.Value),
     Or(
     Not(ThisItem.'A2'.Value = ValueA2.SelectedItems.Value),
     Or(
     Not(ThisItem.'A1a' = ValueA1a.Value),
     Or(
     Not(ThisItem.'A1b' = ValueA1b.Value),
     Or(
     Not(ThisItem.'A1b1' = ValueA1b1.Text),
     Or(
     Not(ThisItem.'A3' = ValueA3.Value),
     Or(
     Not(ThisItem.'A3a' = ValueA3a.HtmlText),
     Or(
     Not(ThisItem.'A4' = ValueA4.Value),
     Or(
     Not(ThisItem.'A4a' = ValueA4a.HtmlText),
     Or(
     Not(ThisItem.'A5' = ValueA5.Value),
     Or(
     Not(ThisItem.'A5A' = ValueA5a.HtmlText),
     Or(
     Not(ThisItem.'B' = ValueB.Value),
     Or(
     Not(ThisItem.'B1'.Value = ValueB1.SelectedItems.Value),
     Or(
     Not(ThisItem.'B2'.Value = ValueB2.SelectedItems.Value),
     Or(
     Not(ThisItem.'C' = ValueC.Value),
     Not(ThisItem.'C1' = ValueC1.HtmlText)
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
     )
    ,
     Set(
     varFormUpdated,
     true
     );
     Set(
     varStatus,
     "Draft"
     );
     Set(
     varNoticeSent,
     false
     );
     ,
     Set(
     varFormUpdated,
     false
     );
     Set(
     varStatus,
     Blank()
     );
     Set(
     varNoticeSent,
     LookUp(
     'PSMF Requirements',
     ID = Value(IDValue.Text),
     'Approval Notice Sent'
     )
     );
     
    );

    This is checking every required input field for changes. If there are changes, approval may be required so I'm using the results to expose the approval portions of the form when necessary. 


    But of course, the comparison of the A1, A2, B1 and B2 fields and their corresponding combo boxes on the form does not work. I get the error that a table can't be compared to a table. Have tried different variations such as adding .Value behind each. No difference.  I tried replacing the ValueA1.SelectedItems with your filter code and that also doesn't work. I get an error about it expecting a single column table. 

     

    Again, all I'm trying to do is compare the saved values of fields A1, A2, B1 and B2 with the values in the corresponding combo boxes (ValueA1, ValueA2, ValueB1 and ValueB2) when a change is made. This ought to be simple. 

     

    Thanks for your help!

  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    @CCJones ,

    Unfortunately the Not() argument will not work with the structure I posted. You will get a match on every one in either set that does not match.

    You can try to test for Form.Unsaved (this video gives some options here) or assuming the Defualt of each of the controls is the relevant data source field, set a Variable to true on the OnChange of every control (set it to false when you open the form for editing), then simply test if the Variable is true.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • CCJones Profile Picture
    244 on at

    Thanks for this information, @WarrenBelz. I think setting each required field's OnChange property to trigger the button click where OnSelect is 

    If(
     SharePointForm1.Unsaved,
     Set(
     varFormUpdated,
     true
     ),
     Set(
     varFormUpdated,
     false
     )
    )

    may do the trick!

  • WarrenBelz Profile Picture
    153,042 Most Valuable Professional on at

    Hi @CCJones ,

    If you are going to set OnChange of every control, the Variable may be a better (and more reliable) option

  • Verified answer
    CCJones Profile Picture
    244 on at

    I'm having to scrap the multi-select SP list choice fields and just make them multiple lines of text instead. I then use lookup lists for the combo box dropdowns (could hard code the choices into the combo box, but want the owner to be able to update them easily) and compare 

     

    Concat(
     ValueA1.SelectedItems,
     Description,
     "; "
    )

     

    with the multiple lines of text field. That works every time. 

     

    Thanks for getting my brain started up again at least, @WarrenBelz ! 🙂 And I'm sure that Form.Unsaved will come in handy in the future.

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard