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?
Solved! Go to Solution.
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)
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:
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 formula. In 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
Thanks for the reply. I did tried on blank canvas and seem having same issue.
I also include video showing how i did the canvas app from scratch.
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)
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
I am currently experiencing the same issue !! I incur the type error whether I grab from a collection or hard code the option ??
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.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
272 | |
257 | |
87 | |
39 | |
34 |
User | Count |
---|---|
348 | |
251 | |
130 | |
68 | |
48 |