cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MudzaffarMansor
New Member

Patch Column Option Set Type Error

Hi,

 

I am trying to patch a data in CDS, 

 

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:"Available"} );Refresh(Inventories)

However, getting the error "The type of this argument InventoryStatus does not match the expected type 'OptionSetValue'. Found type 'Text' "

 

How do i patch the option set type? 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

I have resolved the issue. It seems most of the reference and documentation does not updated. I have resolved it by putting the code like

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:InventoryStatus.Sold} );Refresh(Inventories)

View solution in original post

12 REPLIES 12
v-xida-msft
Community Support
Community Support

Hi @MudzaffarMansor,

Do you want to update the InventoryStatus column value (Option Set Value) of a record in your CDS entity using Patch function?

Is the InventoryStatus column a Option Set type column or Multiple Option Set type column in CDS Entity?

I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

Set the OnSelect property of the "Patch" button to following:

Patch(
TaskLists,
LookUp(TaskLists, 'Primary Name'="1002"),
{
Approve_Status: "Rejected" /* <-- Approve_Status is a Option Set type column in my Entity*/
}
)

Please check if you have provided a proper value for the InventoryStatus column in your Patch formulaIn other words, the value you provided must has been existed within the available values list of your InventoryStatus column.

Please also take a try to enable the "Use the Common Data Service experimental connector" option within Advanced settings of App settings of your app, then re-load your app, check if the issue is solved.

In addition, please take a try to re-create a new app on your side, then try above formula again, check if the issue still exists.

If the issue still exists, please consider submit an assisted support ticket through the following link:

https://powerapps.microsoft.com/en-us/support/pro/

 

Best regards,

Kris

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

Thanks for the reply. I did tried on blank canvas and seem having same issue.

Screenshot 2019-01-01 at 10.56.45 AM.png

Screenshot 2018-12-31 at 4.50.42 PM.png

 

I also include video showing how i did the canvas app from scratch.

https://1drv.ms/f/s!Ag7iOfP4OCz_uS9M1jFIDfR0CNo1

Anonymous
Not applicable

adding in @CarlosFigueira to review and assist. 

 

@Anonymous

Hi,

 

I have resolved the issue. It seems most of the reference and documentation does not updated. I have resolved it by putting the code like

Patch(Inventories,First(Filter(Inventories,'Inventory Id' = ThisItem.'Inventory Id')),{InventoryStatus:InventoryStatus.Sold} );Refresh(Inventories)

View solution in original post

rtb360test1
Frequent Visitor

Am developing canvas app with gallery , where on click of a button i want to update the optionset value of the selected record. For that am using the "onselect" of the button as below. How you people are taking Inventorystatus in your sample. Note:"new_status" is my optionset field.

 

Patch(entityA, ThisItem,{ new_status:"XXXX" });ModelDrivenFormIntegration.SaveForm();


 

How you are loading inventorystatus values here 

power_napps
Frequent Visitor

I am currently experiencing the same issue !! I incur the type error whether I grab from a collection or hard code the option ?? 

 

Romsteck
Advocate III
Advocate III

Up !

 

Any solution to do that ?

 

Thanks 

This took some working out........ Define a link in the patch to the Option List Column. e.g.

patch(TableName,Lookup(Record1),{OptionList:[@OptionList]."Option1"});

This will add "Option1" to the Column "OptionList" for Record1. The key is the [@OptionList] syntax.

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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (39,639)