cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MinhPham96
Level: Powered On

How to patch an option set field

Hello currently I have a travel canvas app with a travel entity, here I have a field called type which is an option set with three values. I used patch to create new travel, and I follow this tutorial to patch an option set field but it did not work. Here are the steps that I did:

 

First I check the value of each option:

2019-12-10_10-48-23.png

 

In the canvas app, I create a collection OnStart

2019-12-10_10-49-06.png

 

Then I stored the collection in a combo box, I also disabled multiple selection option

2019-12-10_10-49-27.png

 

And this is the patch function and the error message (I tried both Selected and SelectedItems from the ComboBox). 

2019-12-10_10-59-35.png

 

Thank you for reading.

 

Best Regards,

 

Minh Pham

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: How to patch an option set field

Hi @MinhPham96 ,

Do you want to use a combo box to update an option set?

Actually, you do not need to create a collection to update.

You just need to use "ComboBox1.Selected.Value" to update.

I've made a similar test for your reference:

1)my optionset named: test123

  option set items: New , Registered

  optionset field named: ExpenseStatus 

1211.PNG

 

2)insert a combo box, set the combo box's Items:

Choices(testmanies.'ExpenseStatus ')

3)insert a submit button, set the button's OnSelect:

Patch(testmanies,First(testmanies),{'ExpenseStatus ':ComboBox1.Selected.Value})

Then, click the submit button,you could update option set field.

 

What's more, if you do not use combo box to update an option set field, you just need to use "optionsetname.valuename".

For example:

Patch(testmanies,First(testmanies),{'ExpenseStatus ':test123.New})
Patch(testmanies,First(testmanies),{'ExpenseStatus ':test123.Registered})

 

 

 

Best regards, 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: How to patch an option set field

Hi @MinhPham96 ,

Do you want to use a combo box to update an option set?

Actually, you do not need to create a collection to update.

You just need to use "ComboBox1.Selected.Value" to update.

I've made a similar test for your reference:

1)my optionset named: test123

  option set items: New , Registered

  optionset field named: ExpenseStatus 

1211.PNG

 

2)insert a combo box, set the combo box's Items:

Choices(testmanies.'ExpenseStatus ')

3)insert a submit button, set the button's OnSelect:

Patch(testmanies,First(testmanies),{'ExpenseStatus ':ComboBox1.Selected.Value})

Then, click the submit button,you could update option set field.

 

What's more, if you do not use combo box to update an option set field, you just need to use "optionsetname.valuename".

For example:

Patch(testmanies,First(testmanies),{'ExpenseStatus ':test123.New})
Patch(testmanies,First(testmanies),{'ExpenseStatus ':test123.Registered})

 

 

 

Best regards, 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

MinhPham96
Level: Powered On

Re: How to patch an option set field

Dear @v-yutliu-msft , I looked for hours and never thought the solution is this simple, thank you for your support 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,919)