cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mkusler
Helper IV
Helper IV

Adding a Multi-Select Combobox to an Existing Patch

I have the current code in my "OnSelect" for a button and everything works just as it should.

 

Patch(CI_Project_Repository,Defaults(CI_Project_Repository),IntakeForm.Updates,
{
BusinessSegment: Dropdown1.Selected.Value,
BusinessSegmentDetail: ComboBox1.Selected.Value
}
);
If(!IsEmpty(Errors(CI_Project_Repository)),Notify("Submission Failed, Please Try Again",NotificationType.Error),
Navigate(NextStepsScreen);
)
)

 

However, my requirements changed and ComboBox1 is now a multi-select dropdown and I want to patch all the selections to my SharePoint List. How do I do that?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @mkusler ,

You really have two choices with a multi-select combo box

  1. Save back to a multi-select Choice column with the code as per my post.
  2. Save to a text field with concatenated values as per this blog of mine.

The first is my preferred option generally as the control is designed to work with this field type.

The second option works, but with an annoying glitch - if the user wants to edit the content of the box (after the items have been initially selected and saved), they need to delete all existing content and re-select the new content they need.

 

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.

Visit my blog Practical Power Apps

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @mkusler ,

This should work

Patch(
   CI_Project_Repository,
   Defaults(CI_Project_Repository),
   IntakeForm.Updates,
   {
      BusinessSegment: Dropdown1.Selected.Value,
      BusinessSegmentDetail: 
      ForAll(
         ComboBox1.SelectedItems As aPatch,
         {Value: aPatch.Value}
      )
   }
);

 

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.

Visit my blog Practical Power Apps

mkusler
Helper IV
Helper IV

@WarrenBelz 

 

Thank you for the response. I used that exactly and am still getting this error.

 

The type of this argument 'BusinessSegmentDetail' does not match expected type 'Text'. Found type 'Record'

 

Do I have something wrong?

@mkusler ,

Please see amended post - problem with engaging keyboard before brain is properly in gear . . .

@WarrenBelz 

 

I am still getting an error, but this time it says:

 

The type of this argument 'BusinessSegmentDetail' does not match expected type 'Text'. Found type 'Table'

 

Error.jpg

 

Is there a setting somewhere that I may be overlooking?

@mkusler ,

What type of field is BusinessSegmentDetail ? The code is valid if used with a multi-choice field.

@WarrenBelz 

 

I had it set as a "Single Line of Text". The reason being is that I have two dropdowns that are not part of my form. 

 

The first being Business Segment with the following Items:

 

["Choose Business Segment", "******* Gaming (Land-Based)","Mobile Gaming (Online)"]

 

The second ComboBox is Business Segment Detail with the following Items:

 

If(Dropdown1.Selected.Value = "Choose Business Segment", ["Choose Business Segment"],

 

If(Dropdown1.Selected.Value = "******* Gaming (Land-Based)", ["","*******", "*******", "*******", "*******", "*******", "Customer Experience Solutions (CSX)"],

 

If(Dropdown1.Selected.Value = "Mobile Gaming (Online)", ["","*******", "*******"])))

 

I'm thinking now that it may just be easier to create a second form, create the proper choice columns in SharePoint and simply update both forms at the same time and abandon patching the dropdowns I created in PowerApps back to SharePoint.

 

Hi @mkusler ,

You really have two choices with a multi-select combo box

  1. Save back to a multi-select Choice column with the code as per my post.
  2. Save to a text field with concatenated values as per this blog of mine.

The first is my preferred option generally as the control is designed to work with this field type.

The second option works, but with an annoying glitch - if the user wants to edit the content of the box (after the items have been initially selected and saved), they need to delete all existing content and re-select the new content they need.

 

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.

Visit my blog Practical Power Apps

mkusler
Helper IV
Helper IV

@WarrenBelz 

 

Thank you for the help and additional information.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,650)