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 Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,923)