cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SBlack6
Frequent Visitor

Compare multi-choice combo box to Share Point list Text field populated from a multi-choice combo box

I need to verify the options selected in a multi-choice combo box are the same (although order doesn't matter) as the options in a text field from SharePoint list being referenced in a gallery.

 

Set Up: The app allows people to submit inputs. Once inputs are submitted, they can look at all their previous inputs from a gallery and make edits if needed. I track changes to any fields that are updated in the SharePoint list the inputs are patched to by creating additional Yes/No dropdowns that compare the input within a control in the app to the corresponding field in the SharePoint list. A yes for the dropdown value will track that a change was made and when the inputs are patched to SharePoint documents the field the change was made.

 

This is straight forward for text inputs and single value combo boxes, but I cannot get the multi value combo boxes selected items comparisons with the previous submission (stored on a SharePoint list). This may have to do with the fact that inputs from the original submission are patched with Concat to the SharePoint list. All SharePoint list fields are text fields, and I get the inputs from the initial submission of information into SharePoint using the Patch function, not using edit forms.

 

Names of Databases/Controls:

  • Share Point list name: Sand Box
  • Name of (one of the) combo boxes for new submissions: cbLang

*When "Other" is selected as one of the options of cbLang, it opens up a text input called txtLang, the text input is patched to SharePoint with the inputs from the combo box.

  • Name of SharePoint column this combo box is patched to: Language(s)
  • Name of gallery on the view/edit screen of the app: galSandBox
  • Name of corresponding combo box in the view/edit screen: cbLang_1
  • Name of dropdown which compares values: ddChLang

 

Patching Code for the above combo box from the New Submission screen is:

Patch(
    'Sand Box',Defaults('Sand Box'),
    {'Language(s)':Concat(Filter(cbLang.SelectedItems, !(Value="Other")), Value&Char(10)) & txtLang.Text})

 

Default Selected Value for cbLang_1:

{Value: galSandBox.Selected.'Language(s)'}
*Note: the default values appear as a single block of text, so you cannot remove only one choice; if you need to delete a value, you would need to delete the entire input.
 

Default Selected Value for ddChLang:

If(ddLang_1.Selected.Value<>galSandBox.Selected.'Language(s)',"Yes","No")
 
The above works so that if the user never makes a change to the combo box it will accurately mark the input as no change. The above also works if you add one item to the default selected value and then remove that value. Example: if the initial inputs were "English" and "Spanish", and the user adds "French" and then removes "French", the dropdown will accurately mark the input as no change.
 
However, if the user deletes the initial default inputs and then realizes they didn't mean to change that field and put the same inputs back to how they originally were, the dropdown will still mark the input as changed. Example: if the initial inputs were "English" and "Spanish", and the user deletes the "English Spanish" input, then reselects "English" and "Spanish" the dropdown will mark the input as changed, despite the fact that the initial input and the edited input have the same text and will look identical in SharePoint.
 
Is there a way to fix my code so the dropdown will compare the SharePoint list field to the selected values in the combo box as I'm intending to do?
8 REPLIES 8
WarrenBelz
Most Valuable Professional
Most Valuable Professional

Hi @SBlack6 ,

You have not provided your Filter code, but this blog of mine should point you in the right direction.

 

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

@WarrenBelz: Thank you for the the response. I was not able to get any improvements trying methods listed in the blog. I believe the issue with attempting to use that method is that my SP list column for 'Language(s)' is a text field rather than a choice column. I have it as a Text field so I can Patch both the multiple select combo box and the text input which appears if the "Other" option is selected in the combo box to the same cell within the "Language(s)' column.

 

I was able to get a little closer to the ideal by adding a variable to the input field, varChLang, which is false until the combo box is changed. With this variable set, I updated the Default value of ddChLang to: 

If(varChLang=false,"No",
If(Concat(
Filter(cbLang_1.SelectedItems, !Value="Other")), 
Value&Char(10)) txtLang_1.Text<>galSandBox.Selected.'Language(s)',
"Yes","No"))
 
With this I get am able to achieve a value of 'No Change' if I do not make any changes to the combo box or if I edit the combo box and replace the selected values, including the 'Other' text input, but only if the combo box inputs are selected in the same order as they appear in my SharePoint list.
 
Is there a way to make the dropdown list selected values not dependent on the order the combo box selections are made while still keeping the initial submission for both the combo box and the text input patch through to the same cell within SharePoint?

Hi @SBlack6 ,

The main thing I can initially see here is that the second argument (which is missing a bracket) needs to be tested against a value of some sort.

 If(
      Concat(
      Filter(
         cbLang_1.SelectedItems, 
         !(Value = "Other")
      ), 
      Value & Char(10)
  ),  // equals what ?

 

@WarrenBelz

It is testing to see if it is not equal to the information in the SharePoint list for the item the gallery is referencing. I double checked my code and realized I lost an & the last time I pasted it:

 

 If(
      Concat(
      Filter(
         cbLang_1.SelectedItems, 
         !(Value = "Other")
      ), 
      Value & Char(10)
  )  & txtLang_1.Text
<> galOOE.Selected.'Language(s)',
"Yes",
"No")
)

 

 

Above is what is I currently have which works as long as the selections are made in the same order as the original selection. I believe this is because the original submission uses Concat, turning the selections into a single text string, so the If statement is comparing if the entire text string is exactly the same, including order, rather than checking to see if the individual selected options and the Other text field initially selected are all present. I'm not sure if there is a way to do this when combining the initial submission combo box values with the initial submission Other text field into the same cell within the SharePoint list.

Hi @SBlack6 ,

Try this - note the brackets around the ! argument.

If(
   varChLang <> false &&
   Concat(
      Filter(
         cbLang_1.SelectedItems, 
         !(Value = "Other")
      ), 
      Value & Char(10)
   ) & txtLang_1.Text <> galSandBox.Selected.'Language(s)',
   "Yes",
   "No"
)

 

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

@WarrenBelz: That code gets me the same result. It will produces a No Change value as long as the combo box inputs are selected in the same order as they are listed in the SharePoint list they are comparing the value to, but if the selections to the combo box are made in a different order it produces a Yes Change value.

 

I don't know if there is a direct solution to this issue. I was trying to look into using Sort as a workaround, but I haven't figured out how to do a sort of combo box selected values or how to sort the combo box values through the patch function.

WarrenBelz
Most Valuable Professional
Most Valuable Professional

@SBlack6 ,

I cannot see your data and must admit I am a little puzzled on how the second part could equal a string in a field. I only tried to tidy up the syntax a bit.

@WarrenBelz 

 

Not sure if this will help you see what is happening at all, but here is what the combo box looks like in the app when it pulls the data from SharePoint before making any changes to the Language(s) combo box, cbLang_1. The drop down below the languages combo box is the ddChLang which compares what is in SharePoint to what is in cbLang_1 with the code we have been discussing.

 

SBlack6_3-1716482974337.png

 

 

As well as what the data looks like in the SharePoint list it is pulling the data from:

SBlack6_1-1716482505137.png

In the app, if I delete the default submission and then add them back in the same order, this is how it looks - Notice the drop down indicating if the value is changed from what is in SharePoint still indicates "No"

SBlack6_4-1716483345136.png

If I change the order of what I select in cbLang_1 to still include all the same selections, but they are in a different order, the drop down indicating if the field is changed changes to "Yes":

 

SBlack6_5-1716483711822.png

The goal is to have the app recognize that the contents of cbLang_1 and txtLang_1 (which is visible if "Other" is selected in cbLang_1) are the same as the contents in the single cell in my SharePoint list where the information was patched on a previous submission, even if the selected order of items in cbLang_1 is a different order than how it appears in the SharePoint list cell.

 

If it is possible to use Sort when patching the initial submission and when evaluating the if cbLang_1 & txtLang_1 matches what is in SharePoint, I believe this would work, but I haven't found a way to use the Sort function on combo box inputs.

 

Is this possible to do (either the Sort function on combo box selections or another method to achieve a similar result), or am I trying to achieve something outside the boundaries of Power Apps functions?

 

UPDATE: I was able to get the sort function to work for patching and the comparison as a workaround using:

 

If(
Concat(
Sort(
Filter(cbLang_1.SelectedItems, !(Value="Other")
),
Text(Value)
),
Value&Char(10)
) & txtLang_1.Text

 

 

Thank you for helping me walk through this!

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!   This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions in the Forums to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber of SolutionsSuper UsersNumber of Solutions @anandm08  23 @WarrenBelz  31 @DBO_DV  10 @Amik  19 AmínAA 6 @mmbr1606  12 @rzuber  4 @happyume  7 @Giraldoj  3@ANB 6 (tie)   @SpongYe  6 (tie)     Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersSolutionsSuper UsersSolutions @anandm08  10@WarrenBelz 25 @DBO_DV  6@mmbr1606 14 @AmínAA 4 @Amik  12 @royg  3 @ANB  10 @AllanDeCastro  2 @SunilPashikanti  5 @Michaelfp  2 @FLMike  5 @eduardo_izzo  2   Meekou 2   @rzuber  2   @Velegandla  2     @PowerPlatform-P  2   @Micaiah  2     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 3:Community MembersSolutionsSuper UsersSolutionsPower Apps anandm0861WarrenBelz86DBO_DV25Amik66Michaelfp13mmbr160647Giraldoj13FLMike31AmínAA13SpongYe27     Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Week 4:Community MembersSolutionsSuper UsersSolutionsPower Apps DBO-DV21WarranBelz26Giraldoj7mmbr160618Muzammmil_0695067Amik14samfawzi_acml6FLMike12tzuber6ANB8   SunilPashikanti8

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (2,064)