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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (45,092)