cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
consultantlk
Helper II
Helper II

Patch a Multi-Select Option Set

Hi Everyone,

 

I am trying to patch Multi-Select Option Set values in a CDS table. I have a combobox that allows for multi selection and on select of the submit button I have Patch([Table Name], First(Filter([Table Name], Name = gallerySelected.Name)), Patch({Field1: TextInput1.text), Field2:  optionset.value, Field3: Dropdown1.selected.Value, Field4: Combobox1.selectedItems}); and I am getting the following errors. 

The function 'Patch' has some invalid arguments. 

Invalid argument type. Expecting a Table value, but of a different schema.

Missing column. Your formula is missing a column 'Value' with a type of 'OptionSetValue'

 

When I take away field4 the patch does not give me any errors. I am not sure how to go about this issue. If anyone has a solution and wouldn't mind sharing, that would be greatly appreciated. Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @consultantlk :

Could you tell me what the Combobox1's Items property is ?

I assume the Combobox1's Items property is Choices([Table Name].Field4).

Please try this code:

Patch([Table Name], First(Filter([Table Name], Name = gallerySelected.Name)), Patch({Field1: TextInput1.text), Field2:  optionset.value, Field3: Dropdown1.selected.Value, Field4: Combobox1.selectedItems.Value});

I'v made a similar test:

my data source:

EntityAS

Field4(Multi-Select Option)

1\Add a combo box(ComboBox1)

Items:

 

Choices(EntityAS.Field4)

 

2\Add a button:

OnSelect:

 

Patch(EntityAS,First(EntityAS),{Field4:ComboBox1.SelectedItems.Value})

 

1.JPG2.JPG

Best Regards,

Bof

View solution in original post

2 REPLIES 2
v-bofeng-msft
Community Support
Community Support

Hi @consultantlk :

Could you tell me what the Combobox1's Items property is ?

I assume the Combobox1's Items property is Choices([Table Name].Field4).

Please try this code:

Patch([Table Name], First(Filter([Table Name], Name = gallerySelected.Name)), Patch({Field1: TextInput1.text), Field2:  optionset.value, Field3: Dropdown1.selected.Value, Field4: Combobox1.selectedItems.Value});

I'v made a similar test:

my data source:

EntityAS

Field4(Multi-Select Option)

1\Add a combo box(ComboBox1)

Items:

 

Choices(EntityAS.Field4)

 

2\Add a button:

OnSelect:

 

Patch(EntityAS,First(EntityAS),{Field4:ComboBox1.SelectedItems.Value})

 

1.JPG2.JPG

Best Regards,

Bof

View solution in original post

Hi @v-bofeng-msft , turns out the items property of my combobox was pointing to the option set itself rather than the table field. I changed that and used Combobox1.Selected.Value and it worked. Thank you so much for the help! 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,465)